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

                }

            }
  • 相关阅读:
    python_day10 socket serverr
    python_day10 协程 GEVENT
    python_day10 协程 Greenlet
    python_day10 协程
    python_day10 paramiko模块
    python-day10 线程 queue
    python_day10 event
    python_day10 信号量
    python_day10 锁
    CSS命名规范(规则)
  • 原文地址:https://www.cnblogs.com/wengnet/p/1442724.html
Copyright © 2011-2022 走看看