get list of all user who has access to sharepoint site
-
Monday, April 30, 2012 1:43 PM
Hi All
I want to get the list of all the users who has access to sharepoint in grid view and when i click the user from that list, I need to get the groups of that particulat user using Visual studio 2010.
Thanks & Regards
Kumar
All Replies
-
Monday, April 30, 2012 2:20 PM
SPWeb.Users and SPWeb.SiteUsers is what you're looking for I think.
http://weblogs.asp.net/bsimser/archive/2006/03/13/440169.aspx
- Edited by Chris Seewald Monday, April 30, 2012 2:20 PM
- Edited by Chris Seewald Monday, April 30, 2012 2:48 PM
-
Monday, April 30, 2012 4:47 PMI'm not sure if the syntax has changed much from that 2006 blog post but here is an additional example of SPWeb.Users on MSDN - http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.users.aspx
My Blog - www.JonesingForSharePoint.com
-
Monday, April 30, 2012 5:57 PM
you can just query the user info hidden list to find all the ensured users
the url of the hidden list is http://<site collection url> /_catalogs/users/simple.aspx
Dim userList as SPList = SPContext.Current.Web.SiteUserInfoList
SPQuery query = new SPQuery;
query.Query =@"<Query>
<OrderBy>
<FieldRef Name='Title' />
</OrderBy>
</Query>"var users = userList.GetItems(query ).GetDataTable() ;
// now bind the data table to the grid view

