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;
            }
  • 相关阅读:
    75. Sort Colors
    101. Symmetric Tree
    121. Best Time to Buy and Sell Stock
    136. Single Number
    104. Maximum Depth of Binary Tree
    70. Climbing Stairs
    64. Minimum Path Sum
    62. Unique Paths
    css知识点3
    css知识点2
  • 原文地址:https://www.cnblogs.com/hqbird/p/2044317.html
Copyright © 2011-2022 走看看