SharePoint中低权限用户通过提升权限创建用户组

/// <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
原文地址:https://www.cnblogs.com/tdskee/p/3421078.html