Using jQuery to return all members / users of a group in SharePoint
Determine if a user is within a particular group in SharePoint and act upon the output.
Luckily the standard SharePoint web services allow to query for this information utilising the User Group service at location: http://<server>/_vti_bin/usergroup.asmx.
In particular the method GetUserCollectionFromGroup will provide the complete list including the Windows SAMAccountName (login name) as part of the return.
However, in this instance I was caught a little by a permissions problem. Although I could query the web service, it kept returning a status of “parsererror” and an output of “Access Denied”.
This was resolved by changing the group settings to allow “Everyone” to read the membership of the group.
Code Example
The following code utilises jQuery to access the web service:
Luckily the standard SharePoint web services allow to query for this information utilising the User Group service at location: http://<server>/_vti_bin/usergroup.asmx.
In particular the method GetUserCollectionFromGroup will provide the complete list including the Windows SAMAccountName (login name) as part of the return.
However, in this instance I was caught a little by a permissions problem. Although I could query the web service, it kept returning a status of “parsererror” and an output of “Access Denied”.
This was resolved by changing the group settings to allow “Everyone” to read the membership of the group.
Code Example
The following code utilises jQuery to access the web service:
No comments:
Post a Comment