SPDocumentLibrary.CheckedOutFiles property
Gets the collection of files that are uploaded to the document library but are not checked in.
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
[SubsetCallableExcludeMemberAttribute(SubsetCallableExcludeMemberType.InterfaceType)] public IList<SPCheckedOutFile> CheckedOutFiles { get; }
Property value
Type: System.Collections.Generic.IList<SPCheckedOutFile>An IList<T> object that contains SPCheckedOutFile objects with information about files that have been uploaded but not checked in.
When someone creates a new file or adds a new file to a library that requires check-out, the file is initially checked out. The person who creates or adds the file must check it in before other people can use it. The CheckedOutFiles property returns a collection of SPCheckedOutFile objects with information about files that have been added to the library but have not been checked in.
The following example is a console application that opens the root Web site, finds all document libraries that require documents to be checked out before they can be modified, and prints a report with information about any document that was uploaded but not checked in.
using System; using System.Collections.Generic; using Microsoft.SharePoint; namespace Test { class ConsoleApp { static void Main(string[] args) { using (SPSite site = new SPSite("http://localhost")) { using (SPWeb web = site.OpenWeb()) { Console.WriteLine("Documents Uploaded But Not Checked In"); Console.WriteLine("\n{0,-20} {1,-25} {2}", "Library", "File", "Uploaded by"); Console.WriteLine(new string('-', 70)); foreach (SPList list in web.Lists) { // If users are required to check out documents... if (list.ForceCheckout) { SPDocumentLibrary library = (SPDocumentLibrary)list; // ...print information about files uploaded but not checked in. IList<SPCheckedOutFile> files = library.CheckedOutFiles; foreach (SPCheckedOutFile file in files) { Console.WriteLine("{0,-20} {1,-25} {2}", file.DirName, file.LeafName, file.CheckedOutBy); } } } } } Console.Write("\nPress ENTER to continue..."); Console.ReadLine(); } } }