/// <summary> /// 提升权限创建用户组 /// </summary> /// <param name="groupname">用户组的名字</param> public void CreateGroup(string groupname) { SPSecurity.RunWithElevatedPrivileges(delegate() { try { using (SPSite mySite = new SPSite(SPContext.Current.Site.ID)) { using (SPWeb myWeb = mySite.OpenWeb()) { myWeb.AllowUnsafeUpdates = true; myWeb.SiteGroups.Add(groupname, myWeb.CurrentUser, null, ""); myWeb.AllowUnsafeUpdates = false; } } } catch (Exception ex) { //throw custom exception