我已经构建了一个沙盒 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;
}