【发布时间】:2012-02-26 03:04:25
【问题描述】:
我已经构建了一个沙盒 webpart 解决方案,它贯穿当前 web 的所有组并显示已定义组的所有成员。在我本地的 SharePoint 2010 实例中,webpart 完全按照它应该做的,但在云中我没有输出。我尝试过显示所有可用的组,但 webpart 也没有显示任何内容,我的代码有什么问题?
protected override void RenderContents(HtmlTextWriter writer)
{
base.RenderContents(writer);
foreach (string name in GetGroupMembers())
writer.Write(name);
}
public StringCollection GetGroupMembers()
{
StringCollection groupMemebers = new StringCollection();
SPGroupCollection groups = SPContext.Current.Web.Groups;
//for each item in the collection of groups
foreach (SPGroup group in groups)
//display all users from the defined group
if (group.ToString().Equals(DEFINED_GROUP))
foreach (SPUser user in group.Users)
groupMemebers.Add(user.Name);
return groupMemebers;
}
【问题讨论】:
标签: sharepoint sharepoint-2010 web-parts sandbox office365