SiteUsers, AllUsers and Users are properties of SPWeb Object. But looking to this properties name, its not easy to understand their’s scope. So below is description about this properties:-
- SPWeb.Users :- This represents the collection of users or user objects who have been explicitly assigned permissions in the Web site . This does not return users who have access through a group.
- SPWeb.AllUsers :-This gives us the collection of user objects who are either members of the site collection or who have atleast navigated to the site as authenticated members of a domain group in the site.
- SPWeb.SiteUsers :- This is the collection of all users that belong to the site collection
Note :
SiteUsers > AllUsers > Users
- Users => explicitly provide a user permission to the site
- AllUsers => Users that have accessed the site via some group membership + Users
- SiteUsers => AllUsers for all subsites + site collection admins
Code:
SPWeb web = SPContext.Current.Web; SPUserCollection c1 = web.Users; SPUserCollection c2 = web.AllUsers; SPUserCollection c3 = web.SiteUsers;
No comments:
Post a Comment