GetGroupCollectionFromUser - Description field

Dec 8, 2014 at 2:45 PM
Is it possible to retrieve the "About Me" of the group through SPServices?

Specifically to pull back the Description or "About Me" field that's associated with a SharePoint group?
Coordinator
Dec 8, 2014 at 2:49 PM
Have you tried GetGroupInfo?

M.
Dec 8, 2014 at 3:15 PM
Edited Dec 8, 2014 at 3:16 PM
I used "GetGroupCollectionFromUser". My goal is to get the group details of the current user.

Would the code below be sufficient?
<script type="text/javascript">
loggedinUserGroup="";
    $().SPServices({  
      operation: "GetGroupInfo",  
            userLoginName: $().SPServices.SPGetCurrentUser(),  
            async: false,
            webURL: "/",
            completefunc: function(xData, Status) 
            { 
             $(xData.responseXML).SPFilterNode("z:row").each(function() 
             {              
            console.log($(this).attr("ows_Name"));
            console.log("Description: "+$(this).attr("ows_Description"));
            console.log("Notes: "+$(this).attr("ows_notes"));
             });
                    
      }
     });

</script>
Coordinator
Dec 8, 2014 at 3:20 PM
I think you'll need to do one call to get the current user's groups using GetGroupCollectionFromUser and then one call per group to get the description for each group., assuming I'm understanding your goal.

M.
Dec 8, 2014 at 3:33 PM
Sorry about that. Here's a little more detail.

Depending on which group a user belongs to, we would like to show them corresponding data on a page. For all the groups we created, we added some data in the "About Me" field to signify what kind of group it is making it easier to identify the kind of group. For example: for the different types for finance groups, they will have "Finance" in the "About Me" field. For Accounting groups, they would have "Accounting" in the "About Me" field, etc.

I initially used "GetGroupCollectionFromUser" but the description was showing up blank each time. Not too long ago, I just realized that the problem might have been because I need to use "Notes" instead of description.

Anyway, can I just use "GetGroupCollectionFromUser" or "GetGroupCollectionFromUser" and "GetGroupInfo"?

Thanks for any help you can provide.
Coordinator
Dec 8, 2014 at 3:40 PM
GetGroupCollectionFromUser is going to return all of the groups in which the user is a member. It looks like it is supposed to return the group description in the response. If it isn't, you could then call GetGroupInfo for each of those groups to get the description for the group. I don't see anything about "Notes" in either of those operations' responses.

M.
Coordinator
Dec 8, 2014 at 3:40 PM
BTW, what version of SharePoint are you working with?

M.
Dec 8, 2014 at 3:41 PM
I'm using SharePoint 2010
Dec 8, 2014 at 3:42 PM
I think the internal name of the "About Me" is called "Notes".
Would there be another way to get that data?
Coordinator
Dec 8, 2014 at 3:48 PM
I just looked at a SharePoint 2010 installation, and I think the "About Me" field for a group is the Description. There isn't a "Notes" field that I can see.

M.
Dec 8, 2014 at 3:53 PM
Edited Dec 8, 2014 at 3:59 PM
So, I tried the following code to see the groups the current user is in, but nothing is showing nor am I getting an error. Any ideas?
<script type="text/javascript">
loggedinUserGroup="";
    $().SPServices({  
      operation: "GetGroupCollectionFromUser",  
            userLoginName: $().SPServices.SPGetCurrentUser(),  
            async: false,
            webURL: "http://isaac.issharepoint.com/practice/",
            completefunc: function(xData, Status) 
            { 
             $(xData.responseXML).SPFilterNode("z:row").each(function() 
             {              
            console.log("Description: "+$(this).attr("ows_Name"));
             });
                    
      }
     });

</script>
Coordinator
Dec 8, 2014 at 4:38 PM
This should work for you:
$().SPServices({  
      operation: "GetGroupCollectionFromUser",  
            userLoginName: $().SPServices.SPGetCurrentUser(),  
            async: false,
//          webURL: "http://isaac.issharepoint.com/practice/",
            completefunc: function(xData, Status) { 
               $(xData.responseXML).SPFilterNode("Group").each(function() {              
                 console.log("Description: "+$(this).attr("Description"));
               });     
      }
     });
You need to be sure you're paring thing out from the response correctly.

M.
Dec 8, 2014 at 5:03 PM
Thank You very much. That worked!