getGroupCollectionFromSite (About Me)

Jun 13, 2013 at 8:46 AM
Hi,

I found some helpful posts here on how to list the SP groups on an ASPX page.
The only thing I can't get done is to show the 'About Me' description of the groups.

If I use the 'description' attribute, the 'About Me' information is only shown for the default SharePoint groups.

I'm trying this on a MOSS environment.
The script is:
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script type="text/javascript" src="http://site/CodeLibrary/jquery.SPServices-2013.01.js"></script>
<script type=text/javascript>
jQuery(document).ready(function($){
    $().SPServices({
        operation: "GetGroupCollectionFromSite",
        async: false,
        completefunc: function (xData, Status) {
            $(xData.responseXML).find("Group").each(function() {
                if($(this).attr("Name").substring(0,3) == "DL-")
                {
                    $("#data").append("<tr><td class='ms-vb'><a href='http://site/_layouts/people.aspx?MembershipGroupId="+ $(this).attr("ID") + "'>" + $(this).attr("Name") + "</a></td><td class='ms-vb'>" + $(this).attr("description") + "</td></tr>");
                }
            });
        }
    });  
});        
</script>
<div>
    <table id="data">
    <th class="ms-vh" nowrap="nowrap">Group Name</th>
    <th class="ms-vh" nowrap="nowrap">About Me</th>
    </table>    
</div>
Jun 14, 2013 at 10:07 AM
Anyone?

I'm desperate on this.
Jun 14, 2013 at 12:49 PM
Hi Benno_BE,

I think this may be what you are after:
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/2013.01/jquery.SPServices-2013.01.min.js"></script>

<script type=text/javascript>
var grpdescription1, grpdescription2;

jQuery(document).ready(function($){
    $().SPServices({
        operation: "GetGroupCollectionFromSite",
        async: false,
        completefunc: function (xData, Status) {
            $(xData.responseXML).find("Group").each(function() {
              grpdescription1 = $(this).attr("Name");

              $().SPServices({
                operation: "GetGroupInfo",
                async: false,
                groupName: grpdescription1,
                completefunc: function (xData, Status) {
                  $(xData.responseXML).SPFilterNode("GetGroupInfo").each(function() {
                    $(xData.responseXML).SPFilterNode("Group").each(function() {
                      grpdescription2 = $(this).attr("Description");
       
                    });
                  });
                }
              }); 

              $("#data").append("<tr><td class='ms-vb'><a href='/_layouts/people.aspx?MembershipGroupId="+ $(this).attr("ID") + "'>" + $(this).attr("Name") + "</a></td><td class='ms-vb'>" + grpdescription2 + "</td></tr>");
            });
        }
    });  
});  
</script>

<div>
    <table id="data">
    <th class="ms-vh" nowrap="nowrap">Group Name</th>
    <th class="ms-vh" nowrap="nowrap">About Me</th>
    </table>    
</div>
AFAIK, the group description isn't available when using GetGroupCollectionFromSite, so I've used GetGroupInfo here to pull out the Description field (aka "About Me") for each group. I know the code could be written better - let me know if this doesn't work, or if I've misunderstood what you're after!
Jun 14, 2013 at 1:05 PM
Hi alibby251,

Thank you for your response.
Unfortunately this is not doing exactly what I want it to do.

The script that you provided does exactly the same as my script and gives this result:
Script result

What I need to have is the 'About me' details of the People and groups which is:

People and Groups result
Jun 14, 2013 at 2:03 PM
Hi Benno,

Mmm - I see what you mean by the differences!

I based my code on SP2007 (which I have to use for the time being) - can I confirm that the details you need are from http://siteurl/_layouts/groups.aspx?
Jun 14, 2013 at 2:12 PM
alibby251,

That's correct.
I'm also using SP2007 MOSS. So that's already one less thing to worry about. :)

I really appreciate your help here.
Jun 19, 2013 at 2:57 PM
Hi Benno,

I've been giving this more thought - I think it may be possible to achieve this, by taking a slightly different tack, and combining my above original code sample with GetListItems (which references the "User Information List").

AFAIK, this holds all users and groups stored within a site collection, and therefore available for use by any site. At a high level, I suspect it would be a case of referencing this first, to get a list of names, then using the GetGroupInfo web call to get individual details about the groups it comes back with. I'm not 100% sure on this, but hopefully it might give you the names you need, once you've filtered out the people names.

Have a look at https://spservices.codeplex.com/discussions/437512 - there's an example of how to reference "User Information List" about half way down?

Hopefully this might be a little closer to the mark - apologies in advance if I've sent you the wrong way...!
Jun 20, 2013 at 10:57 AM
Hi alibby251,

That was very useful information! :D
I'm almost there in finishing my solution.

Although I came across one more problem. It seems that you need to have SCA (site collection admin) rights in order to access the UIL.
I my case that's not really a problem because I'm the SCA, but the page is intended for users who have at least Contribute access, so I'm guessing that this solution isn't going to work for them?

Any thoughts on this?

Thanks for your help so far.
Jun 20, 2013 at 10:32 PM
No worries - glad you found it useful!

With regards to the issue of permissions - yes, unfortunately access to the UIL does require site collection level access or above...

However, I'm growing a little more intrigued by what it is you are trying to achieve - are you about to elaborate at all please? Are you trying to create something like a site directory, so your users can see what sites are in each site collection, and see some basic detail about each site? I think there may also be something more fundamental going on here, which we've also missed?

The reason for asking is that I am not sure accessing the UIL is the right way to do this - sure, you can access it, as there is nothing technically stopping you from doing so. However, I believe the reason why you may actually not see all of the groups is because the UIL contains all information on groups and / or users available to that site collection. I think the discrepancy you have seen is because whilst the groups may exist, they are not actually being used, as they have not had role types assigned to them?

It would help to understand more of what you are trying to achieve in terms of business requirements - we can then look at what the alternatives are.
Jun 21, 2013 at 12:05 PM
Well the whole story behind this is not so spectacular.

It goes as this, I have one or more site collections which have tons of DLs as security groups mixed with standard SP groups.
But because there are so many DLs and groups on those site collections the /_layouts/groups.aspx is paginated.
So I thought it would be quite handy for the site owner (Full control) to provide a page where the DLs are listed with the DL description.

And that's actually the whole story. :) Not so interesting, but more interesting to achieve it.

Today a colleague of mine came up with another idea.
Why not load the /_layouts/groups.aspx page via an AJAX call into another page and pare thru that page and filter out the DL groups. :)
That's actually also a brilliant idea (not taking into account the pagination).

Hope this makes sense?
Jun 21, 2013 at 4:53 PM
Hi Benno,

It does make sense - it actually also gives me an idea, although it depends on the answer to a question: I assume by DLs, you're referring to AD security groups that have been used as permission groups in SharePoint, correct?

If so, then I potentially have an idea for you - AFAIK (but I could be wrong - apologies in advance if I am!), I think AD groups are effectively seen as users in SharePoint, and not just groups. I know this sounds weird, so bear with me:

Any AD group used in my SP system, will show as <DOMAIN>\<AD GROUP NAME>, when viewing the _layouts\groups.aspx page in SharePoint. With this in mind, I think it may be possible to use GetUserCollectionFromSite to see if you can get back a list of these "users", which you could then extract into a list? This could potentially mean that normal users have access to view the page too, so there is less of a concern about having to pipe in content using AJAX, or access being restricted due to permissions.

Does this sound like a possibility, at least to help get you a step further?