Я пытаюсь использовать GetPermissionCollection, чтобы получить список пользователей и их доступ к сайту SharePoint. Мне удалось использовать GetUserCollectionFromSite, но приведенный ниже код, кажется, возвращает пустой ответ, и я не могу понять, почему.
Sub permissions()
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>" + _
"<GetPermissionCollection xmlns='http://schemas.microsoft.com/sharepoint/soap/directory/' />" + _
"</soap:Body>" + _
"</soap:Envelope>"
With CreateObject("Microsoft.XMLHTTP")
.Open "Get", "https://sharepoint.mycompany.com/sites/mysite" & "/_vti_bin/Permissions.asmx", False, Null, Null
.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
.setRequestHeader "SOAPAction", "http://schemas.microsoft.com/sharepoint/soap/directory/GetPermissionCollection"
.send request
xmlDoc.LoadXML (.responseText)
End With
Set nodesCollection = xmlDoc.SelectNodes("//Permissions/Permission")
Set s_id = xmlDoc.createNode(1, "xml", "")
Set s_mask = xmlDoc.createNode(1, "xml", "")
Set s_user = xmlDoc.createNode(1, "xml", "")
Set s_global = xmlDoc.createNode(1, "xml", "")
Set s_role = xmlDoc.createNode(1, "xml", "")
n = 2
For Each nodeElement In nodesCollection
Set s_id = nodeElement.Attributes.getNamedItem("MemberID")
Set s_mask = nodeElement.Attributes.getNamedItem("Mask")
Set s_user = nodeElement.Attributes.getNamedItem("MemberIsUser")
Set s_global = nodeElement.Attributes.getNamedItem("MemberGlobal")
Set s_role = nodeElement.Attributes.getNamedItem("RoleName")
Worksheets("Permissions").Cells(n, 1) = Str(s_id.Text)
Worksheets("Permissions").Cells(n, 2) = s_mask.Text
Worksheets("Permissions").Cells(n, 3) = s_user.Text
Worksheets("Permissions").Cells(n, 4) = s_global.Text
Worksheets("Permissions").Cells(n, 4) = s_role.Text
n = n + 1
Next
End Sub