我写了以下代码,我真的很想测试它:
SPGroupCollection sharePointGroupCollection = contextWeb.Groups;
foreach (SPGroup sharePointGroup in sharePointGroupCollection)
{
if (groupname == sharePointGroup.Name)
{
SPUserCollection sharePointUserCollection = sharePointGroup.Users;
foreach (SPUser sharePointUser in sharePointUserCollection)
{
if (username == sharePointUser.Name)
{
return true;
}
}
}
}
问题是我不知道如何破坏 SPGroupCollection 对象。我知道存在 MSPGroupCollection 鼹鼠对象,但我无法将鼹鼠项 (MSPGroup) 集合添加到我的 MSPGroupCollection 集合中。谁能帮我解决这个问题?我想添加三个或四个具有某些名称的 MSPGroup 对象。比我想用三个或四个具有某些名称的 MSPUser 对象设置一个 MSPUserCollection。我怎样才能做到这一点?
亲切的问候,克里斯蒂安