zoukankan      html  css  js  c++  java
  • 在Moss中获取用户的配置信息

    static void Main(string[] args)
            {
                
    using (SPSite site = new SPSite("http://moss:800"))
                {

                    ServerContext context 
    = ServerContext.GetContext(site);

                    UserProfileManager profileManager 
    = new UserProfileManager(context);

                    UserProfile user1 
    = profileManager.GetUserProfile(@"AW\Administrator");

                    Console.WriteLine(
    "Profile {0}", user1.MultiloginAccounts[0]);

                    
    foreach (Property prop in profileManager.Properties)
                    {

                        Console.WriteLine(
    "\t{0} : {1}", prop.DisplayName, RenderProperty(user1, prop));

                    }

                    Console.ReadLine();

                }


                Console.ReadKey();
            }

            
    static string RenderProperty(UserProfile profile, Property prop)
            {

                UserProfileValueCollection values 
    = profile[prop.Name];

                
    if (values.Value == null)

                    
    return "(NULL)";

                
    if (prop.IsMultivalued)
                {

                    StringBuilder sb 
    = new StringBuilder();

                    
    foreach (object o in values)
                    {

                        sb.AppendFormat(
    "{0} ", o);

                    }

                    
    return sb.ToString();

                }

                
    else
                {

                    
    return values.ToString();

                }

            }
  • 相关阅读:
    Java中使用synchronized多线程同步的实例
    JDK中String类的intern方法实例
    Ubuntu APT按时间顺序排列已安装的软件包
    LinuxMint/LMDE 安装后的配置
    XLNX XC7Z020平台GIC中断示例程序
    吾八哥学k8s(四):kubernetes常用基本命令
    吾八哥学k8s(三):kubernetes里创建资源的方法
    gitlab-runner在Kubernetes环境下挂载宿主机目录的方法
    吾八哥学k8s(二):golang服务部署到kubernetes
    记Windows10下安装Docker的步骤
  • 原文地址:https://www.cnblogs.com/wengnet/p/1442724.html
Copyright © 2011-2022 走看看