SharePoint - Site.RootWeb.AllUsers 未返回所有用户
我有一个 SharePoint 网站,我为其创建了一些自定义 Web 部件。 其中之一需要获取 SharePoint 网站用户列表,以便我可以分配不同的属性。
代码:
Dim Site As New SPSite(SPContext.Current.Site.Url)
Dim AllUsers As SPUserCollection = Site.RootWeb.AllUsers
Dim u As SPUser
For Each u In AllUsers
'SOME CODE FOR DISPLAY
Next
工作得很好,但昨天我添加了一个新用户,但他们没有出现在列表中。 我确实通过显示用户的默认页面在用户列表中看到了它们,所以我想知道为什么这段代码也不能吸引用户。
有谁知道为什么这不会返回 SharePoint 网站中的每个用户?
I have a SharePoint site that I created some custom web parts for. One of them requires getting the list of SharePoint site users so I can assign different properties.
The code:
Dim Site As New SPSite(SPContext.Current.Site.Url)
Dim AllUsers As SPUserCollection = Site.RootWeb.AllUsers
Dim u As SPUser
For Each u In AllUsers
'SOME CODE FOR DISPLAY
Next
Was working great, but yesterday I added a new user and they didn't show up in the list. I definitely see them in the list of users through the default page that shows users, so I'm wondering why this code wouldn't get the user as well.
Does anyone know why this wouldn't return every user in the SharePoint site?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
并非 sharepoint 中的所有用户集合都是平等创建的。 细微差别:
http://www.sharepointblogs.com/tingfong/archive/2007/08/21/sharepoint-spweb-allusers-vs-spweb-users-vs-spweb-groups.aspx
(快速回答对于懒惰的人 - AllUsers 显示活跃用户,即至少与网站集交互过一次的用户)
-Oisin
Not all user collections in sharepoint are created equally. Subtle differences:
http://www.sharepointblogs.com/tingfong/archive/2007/08/21/sharepoint-spweb-allusers-vs-spweb-users-vs-spweb-groups.aspx
(quick answer for the lazy - AllUsers shows active users, i.e. those who have interacted with the sitecollection at least once)
-Oisin