MAC
MAC

Reputation: 6577

Getting All users from from a site

Has anybody have the awareness about to getting all the users from all the site and sub sites. I want to create a access report that will describes each users permission in each and every site and sub site in sharepoint. I am getting all the site and subsites. and i can take the users from each site. But i wish to know that is there any way to get all users firstly and then they involved sites. and what are the permission for each users in that sites.

Thanks in adavance..

Upvotes: 1

Views: 1666

Answers (2)

Sebastian 506563
Sebastian 506563

Reputation: 7238

_web - is web context from site context etc.

SPGroupCollection _collGroups = _web.Groups;
                        foreach (SPUser _User in _web.SiteUsers)
                        {
                           //your code here 
                        }

here u have some client object model how to get users FROM SITE collection scope, if u want to get it from all sites it depend what kind of scope or feature we are talking about becouse they could be other way depend of permission (timer jobs webparts etc) . other way is to get

SPSiteDataQuery

and then

SPSiteDataQuery.Users

Upvotes: 0

Angelo Kee
Angelo Kee

Reputation: 348

We had this one time but what we had was we had our SharePoint server connect to a SQL server which then saves all the users into a single table, together with the permission and the site.

You can use this site as reference as it seems to be the same thing as what you're asking: How to get a list of all users in SharePoint

Upvotes: 0

Related Questions