6
如何通過代碼獲取SharePoint中某個組中所有用戶的列表?如何獲取SharePoint中所有用戶的列表
如何通過代碼獲取SharePoint中某個組中所有用戶的列表?如何獲取SharePoint中所有用戶的列表
我用這第一行代替它,它的工作。謝謝老兄:)
SPGroupCollection collGroups = SPContext.Current.Web.Groups;
foreach (SPGroup oGroup in collGroups)
{
foreach (SPUser oUser in oGroup.Users)
{
Response.Write(oUser.Name);
Label l = new Label();
l.Text = oUser.Name;
PlaceHolderContents.Controls.Add(l);
PlaceHolderContents.Controls.Add(new LiteralControl("<br/>"));
}
}
using (SPWeb oWebsite = SPContext.Current.Site.OpenWeb("Website_URL"))
{
SPGroupCollection collGroups = oWebsite.Groups;
foreach (SPGroup oGroup in collGroups)
{
foreach(SPUser oUser in oGroup.Users)
{
Response.Write(oUser.Name);
}
}
}
謝謝你,但我得到這個錯誤。 「http:// kermit:91/ExternalFAQ/default.aspx」包含非法字符':'。 我應該寫什麼而不是「Website_URL」? – 2009-08-12 15:26:36