SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I allow users to view the users in a sharepoint group? Currently if I try to query users in the site groups using the client object model I get an unauthorized exception.

For example, if I am manager Bob, I want to view the group DBA's, and find out if Bill is in that group.


share|improve this question
up vote 4 down vote accepted

It looks possible:

You can use the SharePoint .NET Framework CSOM to manage SharePoint users, groups, and user security.

Retrieve all users in a SharePoint group

This example retrieves information about all users from a SharePoint group named Members.

// Starting with ClientContext, the constructor requires a URL to the 
// server running SharePoint. 
ClientContext context = new ClientContext("http://SiteUrl"); 

GroupCollection siteGroups = context.Web.SiteGroups; 

// Assume that there is a "Members" group, and the ID=5. 
Group membersGroup = siteGroups.GetById(5); 

foreach (User member in membersGroup.Users) 
    // We have all the user info. For example, Title. 
    label1.Text = label1.Text + ", " + member.Title; 

Reference: How to: Complete basic operations using SharePoint 2013 client library code

If you still get an Access Denied, take a look at the AppManifest.xml and update you permissions for the app:

<?xml version="1.0" encoding="utf-8" ?>
<App xmlns=""

    <AppPermissionRequest Scope="http://sharepoint/content/sitecollection" Right="Read"/>

Reference: App permissions in SharePoint 2013

share|improve this answer
Thanks Benny for your response. That exact query will return "Access denied. You do not have permission to perform this action or access this resource." How can I get permission for all or some users? – Steve Apr 30 '13 at 22:50
@Steve You're Welcome! I'm thinking it has to do with permission level. Have you set it in the AppManifest.xml? – Benny Skogberg May 1 '13 at 4:29
An AppManifest.xml is new to me. So far my client app has functioned without one (I pass user credentials in to the ClientContext and that has allowed me to access all that I've needed (until now)). It sounds like I need to do some reading to see how to implement an app policy? – Steve May 1 '13 at 23:00

I know I may be too late, but I have had the exact same issue you did.

After hours of testing different stuff, I wondered in SharePoint Central Administration and found the solution.

You have to go to the central administration - > application management-> manage web applications , chose the application, click on User Policy (in the ribbon )and add the user you want with Full Read Permissions.

Also don't forget about the ClientContext Credentials.

Hope it helps,


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.