Export (0) Print
Expand All

Lists.GetAttachmentCollection method

Returns a list of the URLs for attachments to the specified item.

Namespace:  WebSvcLists
Assembly:  STSSOAP (in STSSOAP.dll)

[SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/GetAttachmentCollection", RequestNamespace = "http://schemas.microsoft.com/sharepoint/soap/", 
	ResponseNamespace = "http://schemas.microsoft.com/sharepoint/soap/", 
	Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public XmlNode GetAttachmentCollection(
	string listName,
	string listItemID
)

Parameters

listName
Type: System.String

A string that contains either the title or the GUID for the list.

listItemID
Type: System.String

A string that contains the ID for the list item. This value does not correspond to the index of the item within the collection of list items.

Return value

Type: System.Xml.XmlNode
An XML fragment in the following form that contains the URLs for the attachments and that can be assigned to a System.Xml.XmlNode object.
<Attachments>
   <Attachment>http://Server_Name/LISTS/List_Name/
      Attachments/Item_ID/File1_Name</Attachment>
   <Attachment>http://Server_Name/LISTS/List_Name/
      Attachments/Item_ID/File2_Name</Attachment>
   <Attachment>http://Server_Name/LISTS/List_Name/
      Attachments/Item_ID/File3_Name</Attachment>
<Attachments>

The following code example displays the URLs of attachments for a specified item in a list on the current site.

This example requires that a using (Visual C#) or Imports (Visual Basic) directive be included for the System.Xml namespace.

Web_Reference_Folder.Lists listService = new Web_Reference_Folder.Lists();
listService.Credentials= System.Net.CredentialCache.DefaultCredentials;

XmlNode ndAttach = 
    listService.GetAttachmentCollection("List_Name","1");

MessageBox.Show(ndAttach.OuterXml);
Show:
© 2015 Microsoft