zoukankan      html  css  js  c++  java
  • 从人员选择器中取值

    /// <summary>
            /// 从人员选择器中取值
            /// </summary>
            /// <param name="peopleEditor"></param>
            /// <returns></returns>
            public static List<SPPrincipal> GetSPPrincipalsFromPeopleEditor(PeopleEditor peopleEditor)
            {
                List<SPPrincipal> rtn = new List<SPPrincipal>();
                SPWeb web = SPContext.Current.Web;
                SPUserCollection users = web.SiteUsers;
                SPGroupCollection groups = web.SiteGroups;
                foreach (PickerEntity pe in peopleEditor.ResolvedEntities)
                {
                    string principalType = pe.EntityData["PrincipalType"].ToString();
                    if (principalType == "User" || principalType == "SecurityGroup")
                    {
                        string loginName = pe.Key;
                        foreach (SPUser u in users)
                        {
                            if (u.LoginName == loginName)
                            {
                                rtn.Add(u);
                                break;
                            }
                        }
                    }
                    string groupName = pe.Key;
                    foreach (SPGroup g in groups)
                    {
                        if (g.Name == groupName)
                        {
                            rtn.Add(g);
                            break;
                        }
                    }
                }
                return rtn;
            }
  • 相关阅读:
    Docker实用技巧之更改软件包源提升构建速度
    Jenkins 集群搭建
    Jenkins 无法捕获构建脚本错误问题
    CentOS 7 安装 Jenkins
    CentOS 7 安装 JAVA环境(JDK 1.8)
    CentOS 7 源码编译安装 Nginx
    CentOS 7 源码编译安装 Redis
    CentOS 7 源码编译安装 NodeJS
    Chrome 谷歌浏览器清除HTTPS证书缓存
    IdentityServer4实战
  • 原文地址:https://www.cnblogs.com/hqbird/p/2044317.html
Copyright © 2011-2022 走看看