Reputation: 43
I am particularly new with LDAP and wanted to know if there is a way we could know what information has been filled in the active directory for a particular domain.
For example I am trying to obtain the image of the employees of an organization using
var bytes = directoryEntry.Properties["thumbnailPhoto"].Value;
But this returns null. Now I want to know if the image exists and maybe I am not getting it the right way or there is no image?
Upvotes: 3
Views: 7442
Reputation: 663
What about convert to base64?
var bytes = directoryEntry.Properties["thumbnailPhoto"].Value;
if (buffer != null)
var base64Thumb = Convert.ToBase64String(buffer);
Upvotes: 1
Reputation: 14943
Try it this way
var data = user.Properties["thumbnailPhoto"].Value as byte[];
if (data != null)
using (var s = new MemoryStream(data))
return Bitmap.FromStream(s);
else
foreach (PropertyValueCollection p in user.Properties)
Trace.WriteLine(p.PropertyName);
Double-check the property, it might be jpegPhoto
byte[] data = user.Properties["jpegPhoto"].Value as byte[];
Source:
Upvotes: 1