Reputation: 23278
I found a way to get email address of some principal using ADsGetObject. However, it requires COM.
My app doesn't use COM and I don't want to initialize it, just for the sake of doing one API call.
Have you seen any Windows API which allow to get a user email?
Upvotes: 0
Views: 434
Reputation: 942000
Active Directory programming requires COM, there is no lower level API.
Looking for alternatives: there is no great advantage to using C++ when dealing with something like email. It tends to work just as well from a scripting language, the bottleneck is not the language. Using ADSI from a scripting language (or especially .NET) is quite easy, they have runtime environments that take care of the COM plumbing.
The twenty dollar solution: add the required config instead of trying to read it back from AD.
Upvotes: 2