SPDocumentLibrary Class

The SPDocumentLibrary class represents a document library in Microsoft Windows SharePoint Services.

System.Object

Microsoft.SharePoint.SPList

  **Microsoft.SharePoint.SPDocumentLibrary**

Public Methods

The following table shows the public methods of the SPDocumentLibrary class and a brief description of each.

Name Description
GetItemsInFolder Returns a collection of items from the document library based on the specified view and folder.

Public Properties

The following table shows the public properties of the SPDocumentLibrary class, the data type of each property, and a brief description of each.

Name Data Type Description
DocumentTemplateUrl String Gets or sets the URL of the document template for the library.
EmailInsertsFolder String Gets or sets the path for the public folder that contains the e-mail items inserted in the document library.
IsCatalog Boolean Gets or sets a Boolean value that specifies whether the document library is a site template gallery or list template gallery.
Items Microsoft.SharePoint.SPListItemCollection Returns all the files within the document library, including those in any subfolders.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread safe.

Remarks

To obtain an SPDocumentLibrary object, cast the given list as a document library, such as follows:

[Visual Basic .NET]

Dim documentLibrary As SPDocumentLibrary = CType(list, SPDocumentLibrary)

[C#]

SPDocumentLibrary documentLibrary = (SPDocumentLibrary)list;

Example

The following code example iterates through all the sites and their lists and, excluding catalogs or form libraries, displays the name of the site and list, as well as the file name, for each item in every document library.

This example requires using directives (Imports in Visual Basic) for the Microsoft.SharePoint, Microsoft.SharePoint.Utilities, and Microsoft.SharePoint.WebControls namespaces.

The example assumes the existence of a .aspx page that contains a label control.

Requirements

Namespace: Microsoft.SharePoint

Platforms: Microsoft Windows Server 2003

Assembly: Windows SharePoint Services (in Microsoft.SharePoint.dll)

Security: Code Access Security