Quantcast
Channel: jQuery Library for SharePoint Web Services
Viewing all articles
Browse latest Browse all 6517

New Post: getGroupCollectionFromSite (About Me)

$
0
0
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!

Viewing all articles
Browse latest Browse all 6517

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>