MeTaLiKiD
MeTaLiKiD

Reputation: 565

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

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?

Upvotes: 2

Views: 5532

Answers (1)

MeTaLiKiD
MeTaLiKiD

Reputation: 565

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.

Upvotes: 2

Related Questions