Compartilhar via


SiteData.GetAttachments Method

Returns the URLs for all attachments to a specified item in a SharePoint list.

Namespace:  [SiteData Web service]
Web service reference: http://Site/_vti_bin/SiteData.asmx

Syntax

'Declaration
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/GetAttachments", RequestNamespace := "https://schemas.microsoft.com/sharepoint/soap/",  _
    ResponseNamespace := "https://schemas.microsoft.com/sharepoint/soap/",  _
    Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Function GetAttachments ( _
    strListName As String, _
    strItemId As String, _
    <OutAttribute> ByRef vAttachments As String() _
) As UInteger
'Usage
Dim instance As SiteData
Dim strListName As String
Dim strItemId As String
Dim vAttachments As String()
Dim returnValue As UInteger

returnValue = instance.GetAttachments(strListName, _
    strItemId, vAttachments)
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/GetAttachments", RequestNamespace = "https://schemas.microsoft.com/sharepoint/soap/", 
    ResponseNamespace = "https://schemas.microsoft.com/sharepoint/soap/", 
    Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public uint GetAttachments(
    string strListName,
    string strItemId,
    out string[] vAttachments
)

Parameters

  • strListName
    Type: System.String

    A string that contains either the name of the list or the GUID of the list enclosed in curly braces ({}).

  • strItemId
    Type: System.String

    A string that contains an integer specifying the identifier (ID) of the item.

  • vAttachments
    Type: []

    A string array that contains the URLs of the attachments.

Return Value

Type: System.UInt32

Examples

The following code example displays the URLs of all the attachments to the item whose ID is 105. This example assumes the existence of a label within the form of a Windows Application.

Dim srvSiteData As New Web_Reference_Name.SiteData()
srvSiteData.Credentials = System.Net.CredentialCache.DefaultCredentials

Dim strAttach() As String

srvSiteData.GetAttachments("List_Guid_or_Name", "105", strAttach)

Dim str As String

For Each str In strAttach

    label1.Text = str

Next str
Web_Reference_Name.SiteData srvSiteData = new Web_Reference_Name.SiteData();
srvSiteData.Credentials = System.Net.CredentialCache.DefaultCredentials;

string[] strAttach;

srvSiteData.GetAttachments("List_Guid_or_Name", "1", out strAttach);

foreach (string str in strAttach)
{
    label1.Text = str;
}

See Also

Reference

SiteData Class

SiteData Members

SiteData Web Service