Microsoft Lync 2010 uses photos to enhance the user experience when displaying the contact card. This article explains how you can manage the use of photos and how they are downloaded to clients.

Author:  Jens Trier Rasmussen

Publication date: November 2010

Product version: Lync Server 2010, Lync 2010

Microsoft Lync 2010 introduces the use of user photos on the contact card and other places in the user interface. This article describes how you can configure and control the user experience and how Lync Server 2010 communications software caches and downloads photos.

How It Works

Lync 2010 can display the photo of the signed-in user from two different sources:

  • The thumbnailPhoto attribute on the user's object in Active Directory Domain Services
  • A URL configured by the user

The thumbnailPhoto Active Directory attribute is the same source that is used by Microsoft Outlook messaging and collaboration client and Microsoft Exchange Server 2010 to display the user's photo in Microsoft Outlook 2010. This attribute stores a binary representation of the photo. Lync 2010 does not offer a direct method to import a picture to the thumbnailPhoto attribute. However, you can use Microsoft SharePoint Server 2010 to upload your photo to your My Site and then configure profile synchronization in SharePoint Server 2010 to synchronize the photo to the thumbnailPhoto attribute in Active Directory. Lync 2010 offers the option to open the Edit Profile page of the user's My Site to enable the user to upload the photo. Alternatively, you can use the Exchange Management Shell in Exchange Server 2010 to import pictures to Active Directory.

Users can also configure their picture by specifying a URL for the photo that they want to use. The photo must be in JPEG format and must be publically readable. The URL is transferred to other users through the contact card category in the presence information. When Lync 2010 needs to display the photo it retrieves it from the received URL.

Controlling the Photo Experience

Lync Server 2010 uses the CsClientPolicy policy to configure client side settings. Settings are sent to clients through in-band provisioning. To control the photo experience of users, you can use the two CsClientPolicy parameters DisplayPhoto and MaxPhotoSizeKB. The corresponding in-band provisioning parameter for DisplayPhoto is called PhotoUsage and for MaxPhotoSizeKB the name is the same and they are transferred in the endpointConfiguration provisionGroup. These parameters are explained in detail in the following sections. In the discussion we will use the naming in CsClientPolicy.

DisplayPhoto controls how photos are displayed in the client. The different values are listed in the following table.

 

MaxPhotoSizeKB controls the maximum size in Kb of the photos that can be displayed.

Based on these parameters, Lync 2010 provides the user options to configure how the photos are used. Figure 1 shows DisplayPhoto set to AllPhotos and MaxPhotoSizeKB set to 100 Kb.

Figure 1. Photo configuration in Lync 2010

Figure 1. Photo configuration in Lync 2010

Managing Downloading of Photos

Both Lync Server 2010 and Lync 2010 employ caching to avoid unnecessary download of photos to the client. The download of photos is not dependent on how the address book is made available to the client (meaning, the setting of AddressBookAvailability in the CsClientPolicy), because photos are not stored in the GalContacts.db database.

Photos Stored in Active Directory

Lync 2010 queries Lync Server 2010 by using the Address Book Web Query (ABWQ) to retrieve photos. The queries include three attributes:

  • PhotoHash contains a hashed value of the photo binary data and is used to determine if the current photo has changed.
  • PhotoRelPath contains the relative path to the actual photo stored on the server.
  • PhotoSize is the size of the photo in bytes.

Client Side

When Lync 2010 determines that it needs a photo, it issues a search request to the Lync Server. In the search request it asks ABWQ to return a set of attributes including PhotoRelPath, PhotoSize, and PhotoHash. The following is an example of the returned attributes:

<Attribute>

          <Name>PhotoRelPath</Name>

          <Value>efa6096aed2746cb9ab2037f7dbdde9d.f2eeeb5946db54a7aa607ecd3ae09d95.photo</Value>

          <Values xmlns:d6p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" i:nil="true" />

</Attribute>

<Attribute>

          <Name>PhotoHash</Name>

          <Value>f2eeeb5946db54a7aa607ecd3ae09d95</Value>

          <Values xmlns:d6p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" i:nil="true" />

</Attribute>

<Attribute>

          <Name>PhotoSize</Name>

          <Value>4620</Value>

          <Values xmlns:d6p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" i:nil="true" />

</Attribute>

Lync 2010 then checks the PhotoSize returned against the MaxPhotoSizeKB it obtained from in-band provisioning. If the PhotoSize multiplied by 1024 is less or equal to MaxPhotoSizeKB, the client will retrieve the photo by using an HTTP GET request using the URL https://<absInternalServerUrl>"/"<PhotoRelPath> or https://<absExternalServerUrl>"/"<PhotoRelPath>, where the base URLs, https://<absInternalServerUrl> and https://<absExternalUrl>, are obtained through in-band provisioning.

The client then caches the photo of the signed-in user locally. It also stores the PhotoRelPath, PhotoSize, and PhotoHash in the cached Address Book Service (ABS) entry for the user. It also stores a timestamp that indicates when the photo was downloaded from the Lync Server. This cached data is located in %userprofile%\AppData\Local\Microsoft\Communicator\sip_<SIP URI>\ABS_<SIP URI>.cache.

To avoid downloading the photo every time, Lync uses the photo from its cache. After 24 hours from the time Lync caches the photo, the client sends a request to the server to find out whether the photo has changed by comparing the PhotoHash value sent by the server to its local value. If the photo has changed, Lync updates its cache with the new photo and resets the timestamp.

Server Side

On the server side, the Address Book Service (ABS) is responsible for handling photos. The component responsible for this functionality is in ABWQ and is exposed through the Distribution List Expansion (DLX) web service.  The server uses a cache to limit the load on the Active Directory global catalog servers when requesting photos read from the thumbnailPhoto attribute.

When the ABS receives a request for a photo from a client, it first checks if it already has the photo in its cache. The photos are cached in the same folder as the address book files, <Lync Server filestore>\<WebServer Service Id>\ABFiles\<GUID>\<GUID>. It is the folder with all zeroes in the GUID. The photos are stored as individual files with filenames in the format: <ContactId>.<PhotoHash>.photo (see Figure 2).

Figure 2 Photo cache files

 

The ContactId is an internal identifier for the user that is used by both client and server. To determine which user this ContactId corresponds to, you'll have to dump the ABS database by using the abserver.exe tool: abserver -dump <abs file>. The output provides the correlation between the ContactId with the corresponding user identified by the value of the msRTCSIP-PrimaryUserAddress attribute. This tool, abserver.exe, is provided with Lync Server 2010 and is typically located at C:\Program Files\Microsoft Lync Server 2010\Server\Core.

The client sends the ContactId and the PhotoHash value of the photo in the search request to the server. If this PhotoHash value matches the hash value in the filename, <ContactId>.<PhotoHash>.photo, ABS returns the PhotoRelPath value to the file, <ContactId>.<PhotoHash>.photo, because the picture hasn't changed.

If this PhotoHash value does not match the hash value in the corresponding filename or the photo has not yet been cached, the ABS will get the photo from the local Active Directory global catalog. ABS then computes the hash, stores the photo in the cache, and returns the values of PhotoHash, PhotoRelPath, and PhotoSize to the client.

ABS deletes all cached photos in the nightly maintenance window. Check event 21056 in the event log and look for "Number of cached photos deleted". This means that it can take up to 24 hours before changed photos appear in the photo cache. To expedite this process you can delete the cached photo for the given user or issue the PowerShell command Update-CsAddressBook.

Photos Referenced in Presence Information

The presence information about a photo also contains as hash value. Lync 2010 uses that hash value to determine if it needs to get a new photo for a given user. If the hash value is the same and the photo is stored in the cache, it Lync 2010 use the cached version. If the hash value is different than the stored one, it will fetch a new photo.

The difference between a photo referenced in presence information and photo stored in Active Directory is that Lync 2010 is automatically notified of changes to the photo configuration through the presence information.

Summary

This article has discussed how you can manage the use of photos in Lync 2010 by helping you understand how they are downloaded to the client and how they are handled on the server side.

Additional Resources

Lync Server Resources

We Want to Hear from You

Keywords: photo experience, downloading, Lync, contact card, user photos