共用方式為


Lists.GetAttachmentCollection method

會傳回指定之項目的附件的 Url 清單。

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

Syntax

'宣告
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/GetAttachmentCollection", RequestNamespace := "https://schemas.microsoft.com/sharepoint/soap/",  _
    ResponseNamespace := "https://schemas.microsoft.com/sharepoint/soap/",  _
    Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Function GetAttachmentCollection ( _
    listName As String, _
    listItemID As String _
) As XmlNode
'用途
Dim instance As Lists
Dim listName As String
Dim listItemID As String
Dim returnValue As XmlNode

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

參數

  • listName
    Type: System.String

    字串,包含標題或清單的 GUID。

  • listItemID
    Type: System.String

    內含清單項目的識別碼的字串。此值並未對應至清單項目集合內的項目索引。

傳回值

Type: System.Xml.XmlNode
下列格式,包含附件的 Url 與之可以指派給System.Xml.XmlNode物件 XML 片段。

<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>

Examples

下列程式碼範例會在目前的網站上的清單中顯示指定之項目的附件的 Url。

本範例會要求using (Visual C#) 或System.Xml命名空間所包含的Imports (Visual Basic 中) 指示詞。

Dim listService As New Web_Reference_Folder.Lists()
listService.Credentials = System.Net.CredentialCache.DefaultCredentials

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

MessageBox.Show(ndAttach.OuterXml) '
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);

請參閱

參照

Lists class

Lists members

WebSvcLists namespace