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

  • 相关阅读:
    剑指offer--38.左旋转字符串
    剑指offer--37.和为S的两个数字
    剑指offer--35.数组中只出现一次的数字
    剑指offer--34.数字在排序数组中出现的次数
    剑指offer--33.丑数
    SSIS包定时执行
    在SSIS 的 64 位版本中不支持 Excel 连接管理器[转]
    sql中的sp_helptext、sp_help 、sp_depends
    SQL去除回车符,换行符,空格和水平制表符
    SQL Server中bcp命令的用法以及数据批量导入导出
  • 原文地址:https://www.cnblogs.com/hqbird/p/2044325.html
Copyright © 2011-2022 走看看