zoukankan      html  css  js  c++  java
  • 创建用户组

    SPSecurity.RunWithElevatedPrivileges(delegate()
                    {

                        using (SPSite site = new SPSite(curSite.ID))
                        {
                            using (SPWeb web = site.OpenWeb(curWeb.ID))
                            {

                                site.AllowUnsafeUpdates = true;
                                web.AllowUnsafeUpdates = true;
                                SPMember spUserMember = null;
                                SPUser spUser = web.CurrentUser;
                                //spUserMember = web.SiteAdministrators[0];
                                spUserMember = curWeb.CurrentUser;
                                web.SiteGroups.Add(strUserGroup, spUserMember, null, description);

                                SPList spList = web.Lists["用户信息列表"];
                                SPGroup spgroup = web.SiteGroups[strUserGroup];
                                SPListItem groupItem = spList.GetItemById(spgroup.ID);

                                groupItem["Create"] = (object)curWeb.CurrentUser.LoginName;
                                groupItem["Modifier"] = (object)curWeb.CurrentUser.LoginName;
                                groupItem["IsGroup"] = (object)"职责";
                                groupItem["IsEnable"] = (object)ddlIsEnable.SelectedValue;
                                groupItem.Update();
                                site.AllowUnsafeUpdates = false;
                                web.AllowUnsafeUpdates = false;
                            }
                        }
                    });

  • 相关阅读:
    解决Spring MVC无法接收AJAX使用PUT与DELETE请求传输的内容
    js中定时器setTimeout与setInterval使用方法经验总结
    解决ajax请求(SpringMVC后台)响应415/400/405错误
    css3 calc()的用法
    echarts2 饼图处理标签文字过长使之达到指定字数换行的目的
    在webstorm开发微信小程序之使用阿里自定义字体图标
    webstorm的一些小技巧
    前端 一些小知识,技巧总结
    用webstorm来开发微信小程序之less的配置
    js,mui,jq 操作基本的DOM
  • 原文地址:https://www.cnblogs.com/hqbird/p/2044325.html
Copyright © 2011-2022 走看看