Share via


Item Property

The Item property of the SPAttachmentCollection class gets the absolute URL for the attachment at the specified index in the collection.

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

Parameters

iIndex   A 32-bit integer that specifies the index of the attachment.

Property Value

A string that contains the absolute URL.

Example

The following code example iterates through the collection of attachments for each Announcements list of every subsite and uses the indexer to display the URL for each attachment.

This example requires using directives (Imports in Visual Basic) for both the Microsoft.SharePoint 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