Active Directory Photo Toolkit
Installation
Installation is done via NuGet:
Install-Package ActiveDirectoryPhotoToolkit
Usage
Initial setup:
var directoryEntry = new DirectoryEntry("LDAP://contoso.com");
var adPhoto = new ActiveDirectoryPhoto(directoryEntry);
Retreive a users profile photo from Active Directory in the native format - Bitmap:
var bitmap = adPhoto.GetThumbnailPhotoAsBitmap("ghuntley");
Retreive a users profile photo from Active Directory and convert from native format (Bitmap) to a Jpeg:
var jpeg = adPhoto.GetThumbnailPhotoAsJpeg("ghuntley");
Retreive a users profile photo from Active Directory and convert from native format (Bitmap) to a Png:
var png = adPhoto.GetThumbnailPhotoAsPng("ghuntley");
Remarks
The ability to set a users profile photo is within scope but at this stage is not implemented. This will be revisted in the future but please consider forking this libary, implementing it yourself and submitting a pull-request.
With thanks to
- The icon "Man" designed by Simple Icons from The Noun Project.