What's the best way to get a list of users that are assigned to a SharePoint portal?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
It depends on exactly what list of users you want.
All users that exist in a SharePoint web (but don't necessarily have permission):
SPWeb.AllUsers
Users that exist in a SharePoint web but have been granted some permission:
SPWeb.Users
Users that exist in a SharePoint site collection (but don't necessarily have permission):
SPWeb.SiteUsers
Note: I am assuming you are using WSS 3.0 / MOSS 2007 but this should work for WSS 2.0.
Also look at:
SPWeb.AllUsers vs. SPWeb.Users
SPWeb.AllUsers vs. SPWeb.Users vs. SPWeb.Groups
回答2:
FYI, here's the way that I figured out how to do what I was looking for:
Dim Site As New SPSite("SiteURL")
Dim AllUsers As SPUserCollection = Site.RootWeb.AllUsers
Dim u As SPUser
For Each u In AllUsers
Response.Write(u.LoginName & " " & u.Name & " " & u.Email & "<br />")
Next
标签:
sharepoint