Users, AllUsers 和 SiteUsers
SPWeb 对象有三个与用户的集合有关的属性, 下面列出了他们的区别, 为防止中文含义表达不清, 英文解释也列在下面.
SPWeb.Users
=============
这个是所有直接加过权限的用户,就是add user时候不指定组,直接加个权限. 这些用户不属于任何站点的用户组
(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
=============
Allusers = Users + AD Group.
第一部分和上面一样,第二部分是这个用户登录过站点,但是他的权限是通过在SharePoint上给某个AD的group加权限获得的
(This gives us the collection of user objects who are either members of the site collection or who have at least navigated to the site as authenticated members of a domain group in the site).
SPWeb.SiteUsers
=============
SiteUsers = AllUsers + SharePoint Group = Users + AD Group + SharePoint Group
站点集中的所有的可用的用户, 包括WSS添加的隐藏的用户, 还包括通过SharePoint Group赋予权限的用户.
(All the available users in the site collection, including some hidden users added by WSS. This is the collection of all users that belong to the site collection.)
参考资料:
Users, AllUsers and SiteUsers
http://jason-xge2.blogspot.com/2007/07/users-allusers-and-siteusers.html
鸣谢:
感谢李楠同学的耐心讲解.