This project has moved. For the latest updates, please go here.



Web Service

Users and Groups




Here's an example from greginchicago on EndUserSharePoint's Stump the Panel. We worked through it together and it's a nice use of GetGroupCollectionFromUser to disable the 'Change Password' option for users belonging to a given Permission group in the 'Welcome' drop down located on the top right corner of the default SharePoint page.

Here's the code:

<script type="text/javascript" src="/SRC/SRCjQuery/jquery-1.4.2.min.js"></script>
<script language="javascript" type="text/javascript" src="/SRC/SRCjQuery/jquery.SPServices-0.5.4.min.js"></script>
<script type="text/javascript">
/* place code right before the matching closing tag </asp:Content> for <asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">*/
  $(document).ready(function() {
      operation: "GetGroupCollectionFromUser",
      userLoginName: $().SPServices.SPGetCurrentUser(),
      async: false,
      completefunc: function(xData, Status) {
        if($(xData.responseXML).find("Group[Name='GroupName']").length == 1) {
          /*   zz5_ID_LoginAsDifferentUser
               zz9_ID_PersonalizePage   */
   }); /*close().SPServices({ */
}); /* close (document).ready(function() { */

Last edited May 19, 2010 at 4:33 PM by sympmarc, version 3


jtbon2 May 3, 2013 at 4:55 PM 
Thank you so much for this framework, it's been extremely valuable. Here is a slightly more reusable function if you need to store as a utility function. A callback function is necessary whether async is true or false.

isGroupMember("myGroupName", function(result){
//code here

function isGroupMember(groupName, callback)
operation: "GetGroupCollectionFromUser",
userLoginName: $().SPServices.SPGetCurrentUser(),
async: true,
completefunc: function(xData, Status) {
callback( !!($(xData.responseXML).find("Group[Name='" + groupName + "']").length) ); /* returns bool */

jyione Feb 2, 2013 at 3:33 PM 
GetGroupCollectionFromUser works fine on Windows authentication provider but throws error on claims based. Anyone else experienceing this behavior?

iOnline247 Mar 26, 2011 at 2:44 AM 
Hi rajdeep1510,
Just so your question doesn't get lost in the shuffle, create a new thread under Discussions. All of the questions there are monitored.

rajdeep1510 Mar 25, 2011 at 9:10 AM 
This is very useful and helping me a lot. But is it possible to know for a name, which user group it belongs to ? Can I pass just the name instead of UserLoginName in parameter. I have the name in a variable in "Lastname, Firstname" format and I want to know which group this user belongs to. I am trying to use GetGroupCollectionFromUser but no success yet. Can anyone please help ?