April 2006
Beginner
1114 pages
98h 16m
English
Finally, it is very simple to delete an attachment using the DeleteAttachment method:
Sub DeleteAttachment( )
' Requires web reference to SharePoint Lists.asmx
Dim lws As New clsws_Lists
lws.wsm_DeleteAttachment "Test List", "2", _
"http://www.excelworkshop.com/Lists/Test List/Attachments/2/gudgeon.bmp"
End SubSince DeleteAttachment requires the fully qualified address of the attachment, it is useful to save the address of each attachment somewhere on the worksheet or to create a helper function to retrieve the address from the SharePoint server as shown here:
Function FindAttachment(ListName As String, ID As String) As String
Dim lws As New clsws_Lists ' Requires Web reference to to SharePoint Lists.asmx
Dim xn As IXMLDOMNodeList ' Requires reference to Microsoft XML
Set xn = lws.wsm_GetAttachmentCollection(ListName, ID)
FindAttachment = xn.Item(0).Text
End FunctionRead now
Unlock full access