0
我有這個代碼創建SharePoint用戶組的客戶端列表。如何在SharePoint 2010的列表中選擇用戶組名稱?
namespace CreateGroupCSharp.EventReceiver1
{
public class EventReceiver1 : SPItemEventReceiver
{
public override void ItemAdded(SPItemEventProperties properties)
{
using (SPSite site = new SPSite("http://abc/"))
{
SPWeb web = site.AllWebs[0];
SPList customList = web.Lists["Client"];
string strCount = properties.ListItem.Title.ToString();
string status = properties.Status.ToString();
SPGroup groupOwner = web.SiteGroups.GetByID(int.Parse(web.Properties["vti_associateownergroup"]));
string groupName = strCount;
web.SiteGroups.Add(groupName, groupOwner, null, "Custom SharePoint Group for Demo");
SPGroup wcmGroup = web.SiteGroups[groupName];
SPRoleDefinition designerRoleDefinition = web.RoleDefinitions["Contribute"];
SPRoleAssignment roleAssignment = new SPRoleAssignment(wcmGroup);
roleAssignment.RoleDefinitionBindings.Add(designerRoleDefinition);
web.RoleAssignments.Add(roleAssignment);
wcmGroup.Update();
web.Update();
}
base.ItemAdded(properties);
}
}
}
是否有可能爲SharePoint列表中的每個客戶端創建用戶本身?
如何將這些創建的組分配給列表中的用戶?