最近,一直频繁使用SPQuery或SPSiteDataQuery做SharePoint前后台开发,在基于SPUser的Field进行查询时发现一些比较奇怪的、让人莫名其妙的问题:SPWeb.Users、SPWeb.AllUsers和SPWeb.SiteUsers在不同的域环境和本地环境中出现一些让人不可理解的事情。甚至我都直接怀疑SharePoint设计者在设计开发SPUser这一部分时没考虑周全。下面详述:
(先画个图,改天补上描述)
经过反复排查、试验过程如下:
(我晕,上图画了我半个多小时,明天继续更新)
试验结果如下:
最后让我们看看WSS3.0 SKD上对能获得SPUser对象的几个地方(SPWeb属性)是怎么描述的?
- SPWeb.AllUsers : Gets the collection of user objects that represents all users who are either members of the site or who have browsed to the site as authenticated members of a domain group in the site.
- SPWeb.Users : Gets the collection of user objects that are explicitly assigned permissions in the Web site.
- SPWeb.SiteUsers : Gets the collection of all users that belong to the site collection.
Currently rated 3.2 by 13 people
- Currently 3.230769/5 Stars.
- 1
- 2
- 3
- 4
- 5