ActiveDirectoryPhotoToolkit

A library for working with Active Directory to retrieve or set a users thumbnailPhoto.


Keywords
Active, Directory, thumbnailPhoto, Profile, Photo, Image, Jpg, Jpeg, Bitmap
License
MIT
Install
Install-Package ActiveDirectoryPhotoToolkit -Version 1.0.1

Documentation

Icon

Active Directory Photo Toolkit Build status

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