Partager via


Item(String) Property

The Item property of the SPFileCollection class gets the file object with the specified URL from the collection.

[C#] In C#, this property is an indexer for the SPFileCollection class.

Parameters

urlOfFile   A string that contains the URL of the file.

Property Value

A Microsoft.SharePoint.SPFile object that represents the file.

Example

The following code example uses the indexer to return a specified file object and display the title of the file, when the file was last modified, and the name of the user who modified the file.

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

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

The next code example uses the indexer to copy a file from a document library in one site to a document library in another site.

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

Requirements

Platforms: Microsoft Windows Server 2003

Security: Code Access Security