How to get a System.__ComObject value from Active Directory in C#

孤街醉人 提交于 2019-12-02 01:36:19

问题


After a long period of search I decide to ask my own question about my problem.

I try to get the value of a Property in Active Directory, but I always get a System.__ComObject.

correspondance += compte.Properties["ENTPersonDateNaissance"][0];

I have tried to use :

 Microsoft.VisualBasic.Information.TypeName(compte.Properties["ENTPersonDateNaissance"]

The result is PropertyValueCollection

But I don't know how to get the value?


回答1:


In fact, the variable "compte" is of type DirectoryEntry, I switched it to SearchResult, and now I can access it value with :

compte.Properties["ENTPersonDateNaissance"][0].ToString()

I hope it can help.



来源:https://stackoverflow.com/questions/29819458/how-to-get-a-system-comobject-value-from-active-directory-in-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!