Reputation: 20224
I am reading the displayName property from ActiveDirectory.
On Windows Server 2008, result.Properties["displayName"][0].ToString()
is the displayName,
while on Windows Server 2012, it returns System.Byte[]
. Now I have to convert the value using sth like
var buffer = result.Properties["displayName"][0];
Encoding.%SomeEncoding%.GetString(buffer, 0, buffer.Length);
,
but I don't know which Encoding Microsoft chose - UTF, ISO, Default, Local?
By the way, is there a "cheat sheet" on AD properties and their types available?
Upvotes: 1
Views: 2762
Reputation: 11
You can read a byte value from AD like this:
Encoding.UTF8.GetString((byte[])userRow.Properties["mailNickname"][0]);
Upvotes: 1