Share via


SPAttachmentCollection.Delete Method

Deletes the attachment with the specified file name from the collection.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

Syntax

'Declaration
Public Sub Delete ( _
    leafName As String _
)
'Usage
Dim instance As SPAttachmentCollection
Dim leafName As String

instance.Delete(leafName)
public void Delete(
    string leafName
)

Parameters

  • leafName
    Type: System.String

    The file name of the attachment to delete.

Exceptions

Exception Condition
ArgumentOutOfRangeException

The leafName does not exist in the collection.

Remarks

The process of deleting an attachment with this method requires that the list item be updated to refresh version information.

See Also

Reference

SPAttachmentCollection Class

SPAttachmentCollection Members

Microsoft.SharePoint Namespace