Active Directory Attribute List Using c#

后端 未结 6 1618
青春惊慌失措
青春惊慌失措 2021-01-14 14:30

How i get the list of active directory user attributes(not of particular user i.e.all attributes) e.g.cn,mail etc. using c#?

6条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-14 14:53

    UserPropertyList = new List();
    
    ActiveDirectorySchema currSchema = ActiveDirectorySchema.GetCurrentSchema();
    
    ICollection Collection = currSchema.FindAllProperties();
    
    IEnumerator Enumerator = Collection.GetEnumerator();
    
    while (Enumerator.MoveNext())
    {
       UserPropertyList.Add(Enumerator.Current.ToString());
    }
    

    The above code will add all search attributes of Active Directory to the UserPropertyList...

提交回复
热议问题