Items Property

The Items property of the SPDocumentLibrary class returns all the files within the document library, including those in any subfolders.

Property Value

A Microsoft.SharePoint.SPListItemCollection object that represents all the files in the document library.

Remarks

In C#, this property is the indexer for the collection of files within the document library.

Use the GetItemsInFolder method to return items from specific folders within the document library.

Example

The following code example displays the relative path based on the site and the file name for every file in the 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

Platforms: Microsoft Windows ServerĀ 2003

Security: Code Access Security