私はその後、いくつかの微調整が必要な場合がありますが、これはあなたが道のほとんどを取得するXMLパーサ
に応答を送り、SOAP経由CAMLクエリを使用します。私は似たようなものを使います。
複雑に見えるかもしれませんが、うまくいけばあなたのコミュニティにURLを変更するだけです。
「Debug.Print .responseText」および「debug.print .status」を使用して問題をデバッグできます。ステータス200は、サイトが正常であることを示しています。
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