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?
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:
What about convert to base64?
var bytes = directoryEntry.Properties["thumbnailPhoto"].Value;
if (buffer != null)
var base64Thumb = Convert.ToBase64String(buffer);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.