Not able get CheckOut files in SharePoint Object Model code.

Hi, I am writing a code to get some information related to files uploaded in SharePoint object model
That code getting information only for checked In files but those files which are in Checked Out mode and Checked Out by some other users id so those files information not coming.
Even when running code under “SPSecurity.RunWithElevatedPrivileges(delegate()”
But still not result for CheckOut files.
Below is the code sample to get file version size:
            SPSite oSite = new SPSite("http://sitecollection/");
            SPWeb oWeb = oSite.OpenWeb();
            SPList mylist = oWeb.Lists[libname];
            long fileVersion = 0;
            dt = new DataTable();
            DataRow dtr;
            DataColumn dtc;
            foreach (SPListItem item in mylist.Items)
                int iver = 0;
                fileVersion = fileVersion + item.File.Length;
                SPFileVersionCollection ver_coll = item.File.Versions;
                foreach (SPFileVersion item_ver in ver_coll)
                    iver += item_ver.Size;

                //listSize += item.File.Length;
                fileVersion += iver;
            fileVersion = fileVersion / 1024;
            Label2.Text = fileVersion.ToString();

Kindly guide me.
LVL 10
Minesh ShahSharePoint & all about itAsked:
Who is Participating?
Jamie McAllister MVPConnect With a Mentor SharePoint ConsultantCommented:
You cannot see files that other people have checked out whether you elevate privileges or not. If there is a checked in version of a checked out file you can see that, but if it's not been checked in you'll need to use SPDocumentLibrary.CheckedOutFiles.
Minesh ShahSharePoint & all about itAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.