excel - Can't retrieve SharePoint groups and IDs using VBA -




i trying sharepoint groups of given site in excel using vba. not vba expert , litteraly leaning how use developper tool , language try this.

i found script retrieves lists , guid sharepoint site on expert-exchange, follows.

sub doit2() dim surl string dim senv string dim xmlhtp new msxml2.xmlhttp dim xmldoc new domdocument surl = "https://xxx/_vti_bin/lists.asmx" senv = "<?xml version=""1.0"" encoding=""utf-8""?>" senv = senv & "<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/"">" senv = senv & "  <soap:body>" senv = senv & "    <getlistcollectionresponse xmlns=""http://schemas.microsoft.com/sharepoint/soap/"">" senv = senv & "      <getlistcollectionresult><xsd:schema>schema</xsd:schema>xml</getlistcollectionresult>" senv = senv & "    </getlistcollectionresponse>" senv = senv & "  </soap:body>" senv = senv & "</soap:envelope>"  xmlhtp     .open "post", surl, false     .setrequestheader "host", "webservices.gama-system.com"     .setrequestheader "content-type", "text/xml; charset=utf-8"     .setrequestheader "soapaction", "http://schemas.microsoft.com/sharepoint/soap/getlistcollection"     .send senv     xmldoc.loadxml .responsetext     'xmldoc.save "d:\rainerj\ee\webqueryresult.xml" end  dim xmlnodelist ixmldomnodelist dim xmlnode ixmldomnode dim listguid string dim listname string  set xmlnodelist = xmldoc.selectnodes("//list") ileng = xmlnodelist.length msgbox "list has " + cstr(ileng) + " entries" worksheets(1).activate range("a1").value = "name of list" range("b1").value = "guid of list" range("a1").select  = 0 ileng - 1     set xmlnode = xmlnodelist(i)     listguid = xmlnode.attributes.getnameditem("id").text     listname = xmlnode.attributes.getnameditem("title").text     range("a1").offset(i + 1, 0).value = listname     range("b1").offset(i + 1, 0).value = listguid next msgbox "done" end sub 

since seemed quite close wanted do, tried adapt give me group names , id follows.

sub doit2() dim surl string dim senv string dim xmlhtp new msxml2.xmlhttp dim xmldoc new domdocument surl = "http://xxx/_vti_bin/groups.asmx" senv = "<?xml version=""1.0"" encoding=""utf-8""?>" senv = senv & "<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/"">" senv = senv & "  <soap:body>" senv = senv & "    <getgroupcollectionresponse xmlns=""http://schemas.microsoft.com/sharepoint/soap/"">" senv = senv & "      <getgroupcollectionresult><xsd:schema>schema</xsd:schema>xml</getgroupcollectionresult>" senv = senv & "    </getgroupcollectionresponse>" senv = senv & "  </soap:body>" senv = senv & "</soap:envelope>"  xmlhtp     .open "post", surl, false     .setrequestheader "host", "webservices.gama-system.com"     .setrequestheader "content-type", "text/xml; charset=utf-8"     .setrequestheader "soapaction", "http://schemas.microsoft.com/sharepoint/soap/getgroupcollection"     .send senv     xmldoc.loadxml .responsetext     'xmldoc.save "d:\rainerj\ee\webqueryresult.xml" end  dim xmlnodelist ixmldomnodelist dim xmlnode ixmldomnode dim groupid string dim groupname string  set xmlnodelist = xmldoc.selectnodes("//list") ileng = xmlnodelist.length msgbox "list has " + cstr(ileng) + " entries" worksheets(1).activate range("a1").value = "name of group" range("b1").value = "id of group" range("a1").select  = 0 ileng - 1     set xmlnode = xmlnodelist(i)     groupid = xmlnode.attributes.getnameditem("id").text     groupname = xmlnode.attributes.getnameditem("title").text     range("a1").offset(i + 1, 0).value = groupname     range("b1").offset(i + 1, 0).value = groupid next msgbox "done" end sub 

note surl written when using in editor. xxx here placeholder.

now, problem being original script gives me lists , guid. when try adapt script groups, finds no entries. doing possible ? or did not adapt correctly ?





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -

python - Read npy file directly from S3 StreamingBody -