Partager via


Item(Int32) Property

The Item property of the SPDocTemplateCollection class gets the document template object at the specified index in the collection.

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

Parameters

iIndex    A 32-bit integer that specifies the index.

Property Value

A Microsoft.SharePoint.SPDocTemplate object that represents the document template.

Remarks

The Item property throws an ArgumentOutOfRangeException if the specified index is outside the valid range of indices for the collection.

Example

The following code example iterates through all the sites on a server and uses the indexer to display the site name, the name of each document template, and the template type for every document template.

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