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;
                            }
                        }
                    });

  • 相关阅读:
    vue开发(一)安装
    Ubuntu18.04安装mysql
    使用.NET Framework开发IIS 7.0模块和处理程序拦截请求实现跳转
    Mysql 清空数据后,释放硬盘文件
    依赖注入
    ubuntu 上开发.netcore
    使用python获取微医数据
    Mysql查询某字段重复值并删除重复值
    使用pyinstaller 打包python程序
    堆(heap)和栈(stack)、内存泄漏(memory leak)和内存溢出
  • 原文地址:https://www.cnblogs.com/hqbird/p/2044325.html
Copyright © 2011-2022 走看看