0

I am facing a small problem while using Lync 2013 sdk, all my users are configured in the Active directory along with the user images. But as start logging in the lync(in my application) sometimes the user picture gets loaded and sometimes not although user image is always there in the active directory. Is there any way to increase the success rate of downloading user image. Secondly how to fasten the process of downloading image so that the whole process looks faster although concept of threading is already implemented.

2 Answers2

0

Sorry I do not have an answer, but...noticing that you posted on Thursday, and here it is Monday w/o an answer, consider posting your question here:

Microsoft Lync Client Development Forum

user3076137
  • 111
  • 3
0

When using the Lync API, code similar to the following should get you the Picture as a stream that you can then do with as you wish.

foreach (Contact contact in results.Contacts)
{
    List<ContactInformationType> lookup = new List<ContactInformationType>();
    lookup.Add(ContactInformationType.DisplayName);
    lookup.Add(ContactInformationType.Photo);

    IDictionary<ContactInformationType, object> contactDetails = contact.GetContactInformation(lookup);

    Stream s = (Stream)contactDetails[ContactInformationType.Photo];
    if (s != null)
    {
        string PicturePath = "Photos\\" + (string)contactDetails[ContactInformationType.DisplayName] + ".jpg";
        StreamWriter sw = new StreamWriter(PicturePath, false);
        CopyStream(s, sw.BaseStream);
        sw.Close();
    }
}

This is pretty quick and in my experience always returns the photo from Lync.

Have you set the group policy DisplayPhoto to PhotosFromADOnly to ensure only photos from AD are used otherwise users can select their own photo and the Lync API will return these photos not the ones in AD.

The final option might be to get the image from AD Directory.

Get the email address of the user and search for it in AD. Then read out the thumbnailPhoto attribute.

Byte[] Photo = (Byte[])user.Properties["thumbnailPhoto"].Value; 

Lync contact data on the client is not always up to date with AD and may take up to a day to synchronise, I'm not too sure how that effect Lync photos.

Woffy
  • 98
  • 6