Need help getting permission groups of named site

Aug 6, 2012 at 8:36 AM

Hi,

I'm trying to use SPServices to get the permission groups for a named site, using the following code at site collection level:

    $().SPServices({
      operation:  "GetPermissionCollection",
      url: "http://<site>/<subsite>/_vti_bin/permissions.asmx",
      objectName: "Permissions",
      objectType: "Web",
      completefunc:  function(xData, Status) {	
        $(xData.responseXML).find("Permission").each(function(){
            $("#lienPermissions").append("<a href='~/../../_layouts/people.aspx?MembershipGroupId=" + $(this).attr("MemberID") + "'>" + $(this).attr("GroupName") + "</a><br/>"); 
        });
      }
    });

The problem I have is that out of 3 subsites hosted in this site collection, 2 of them have inherited permissions, whilst one of them doesn't. Each time I try to use the above code to get the groups from the third site, it always returns back the same permissions that the other sites have - I'm not sure where I'm going wrong?

Any ideas?

Aug 6, 2012 at 1:05 PM

I've managed to fix it - I was using the wrong webservice for my needs! D'oh!

Here's the code for anyone who wants it:

        $().SPServices({
            operation: "GetGroupCollectionFromWeb",
            webURL: siteURL,
            async: false,
            completefunc: function (xData, Status) {
              $(xData.responseXML).find("Group").each(function() {
                $("#WSOutput").append("GroupName: " + $(this).attr("Name") + "<br>");
              });
            }
        });

(WSOutput is a standard DIV, and siteURL needs to be set up as an initial variable, using the format of http://site/subsite - I don't think a trailing slash is required.