标签:
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);
}
}
}
标签:
原文地址:http://www.cnblogs.com/furenjian/p/5444609.html