我假設SharePoint 2010及更高版本。
使用SharePoint REST Services獲取具有所需屬性的正確數據項。
REST Services Reference for Sharepoint 2010
REST API Reference for SharePoint 2013
獲取使用SharePoint 2010,從列表中的項目:
http://lab/_vti_bin/listdata.svc/List1()?$filter=startswith(Title,'foo')&$top=1&$select=Title,Column2,Column3
得到列表中的項目使用SharePoint 2013
http://lab/_api/web/lists/getbytitle('List1')/items?$filter=startswith(Title,'foo')&$top=1&$select=Title,Column2,Column3
則Y OU有權要求該網址與VBA(remeber將引用添加到Microsoft WinHTTP Services, version 5.1
和Microsoft XML, v6.0
)
URL = "http://lab/_vti_bin/listdata.svc/List1()?$filter=startswith(Title,'foo')&$top=1&$select=Title,Column2,Column3"
Set req = CreateObject("WinHttp.WinHttpRequest.5.1")
req.Open "GET", URL, False
req.setRequestHeader "Content-Type", "application/xml"
req.SetCredentials "login", "pass", 0
req.Send
Set objXML = CreateObject("Msxml2.DomDocument.6.0")
If Not objXML.LoadXML(req.ResponseText) Then
Err.Raise objXML.parseError.ErrorCode, , objXML.parseError.reason
End If
XML解析是爲你;)
/編輯
當您的文件名過濾器元件,使用:
http://lab/_vti_bin/listdata.svc/Library()?$filter=FileLeafRef eq 'FileName.zip'&$select=Title
你是指文檔庫中文檔的sharepoint listitem屬性? – tinamou
是的,與SharePoint上的文檔相關聯的屬性。如果您將其從網絡上打開,則不是文件屬性。 – Greg