zoukankan      html  css  js  c++  java
  • c#取出LDAP SearchResult所有属性

     string aaa = System.Threading.Thread.CurrentPrincipal.Identity.Name;

                DirectorySearcher ds = new DirectorySearcher();
                ds.SearchRoot = new DirectoryEntry("LDAP://888.888.0.11/CN=Users,DC=***,DC=com", "***", "***");
                ds.Filter = "(objectClass=user)";
                ds.SearchScope = SearchScope.Subtree;
                ds.Sort = new SortOption("Name", System.DirectoryServices.SortDirection.Ascending);
                ds.PageSize = 1024;
                SearchResultCollection rs = ds.FindAll();

                foreach (SearchResult r in rs)
                {
                    ResultPropertyCollection rprops = r.Properties;
                    string prop = null;
                    foreach (string name in rprops.PropertyNames)
                    {
                        foreach (object vl in rprops[name])
                        {
                            prop = name + ":" + vl.ToString();
                            ls.Add(prop);
                        }
                    }
                }

  • 相关阅读:
    c++第十八章-(容器和算法)
    07表与表之间的关系
    06约束
    01 Hello World!
    05文件合并脚本--By Mark Lutz
    04文件分割器脚本
    05数据库用户操作
    03扫描模块搜索路径
    02扫描目录树
    01扫描单个目录
  • 原文地址:https://www.cnblogs.com/furenjian/p/5444609.html
Copyright © 2011-2022 走看看