나는 다음 몇 가지 미세 조정이 필요할 수 있습니다 XML 파서
에 응답을 공급하지만,이 거기 당신에게 대부분의 방법을 얻을 것이다, SOAP를 통해 CAML 쿼리를 사용합니다. 비슷한 것을 사용합니다.
복잡한 것처럼 보일 수도 있지만 모두 잘하면 커뮤니티의 URL을 변경해야합니다.
'Debug.Print .responseText 및'debug.print .status를 사용하여 문제를 디버깅 할 수 있습니다. 200이라는 상태는 사이트가 ok임을 나타냅니다.
function start_here()
set user_list = get_users("http://sites.company.com/sites/00672")
for each n in user_list
debug.print str(n), userlist(str(n))
next
end function
Function get_users(site_URL)
Dim xmlDoc
Set xmlDoc = CreateObject("Msxml2.DOMDocument")
request = "<?xml version='1.0' encoding='utf-8'?>" + _
"<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'" + _
" xmlns:xsd='http://www.w3.org/2001/XMLSchema'" + _
" xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>" + _
"<soap:Body>" + _
"<GetUserCollectionFromSite xmlns='http://schemas.microsoft.com/sharepoint/soap/directory/' />" + _
"</soap:Body>" + _
"</soap:Envelope>"
With CreateObject("Microsoft.XMLHTTP")
.Open "Get", site_URL & "/_vti_bin/usergroup.asmx", False, Null, Null
.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
.setRequestHeader "SOAPAction", "http://schemas.microsoft.com/sharepoint/soap/directory/GetUserCollectionFromSite"
.send request
'Debug.Print .status
'Debug.Print .responseText
xmlDoc.LoadXML (.responseText)
End With
Set nodesCollection = xmlDoc.SelectNodes("//Users/User")
Set ID = xmlDoc.createNode(1, "xml", "")
Set user_name = xmlDoc.createNode(1, "xml", "")
Set user_col = New Collection
For Each nodeElement In nodesCollection
Set ID = nodeElement.Attributes.getNamedItem("ID")
Set user_name = nodeElement.Attributes.getNamedItem("Name")
user_col.Add user_name.Text), Str(ID.Text)
Next
Set get_users = user_col
end function