SPAttachmentCollection.DeleteNow Method
Deletes the attachment with the specified file name from the collection without requiring an update to the parent list item.
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online
Syntax
'Declaration
Public Sub DeleteNow ( _
leafName As String _
)
'Usage
Dim instance As SPAttachmentCollection
Dim leafName As String
instance.DeleteNow(leafName)
public void DeleteNow(
string leafName
)
Parameters
leafName
Type: System.StringThe file name of the attachment to delete.
Exceptions
Exception | Condition |
---|---|
ArgumentOutOfRangeException | The leafName does not exist in the collection. |
Remarks
If you delete an attachment by using the DeleteNow method, the deletion takes effect immediately and you do not need to update the list item to refresh version information. Unlike the behavior of the AddNow method, the deletion takes effect immediately in the current attachment collection object.