User photos in EWS in Exchange 2013
Published: July 16, 2012
Learn about how to request user photos by using EWS in Exchange 2013.
Applies to: Exchange 2013 | Exchange Online
Exchange Server 2013 client applications can request an image that represents an email account. This image, typically a photo of the owner of the email account, can be used by a client application to identify the email account.
You can request user photos from the Exchange server by using a standard HTTPS GET request. In the request, specify the email account address and a size code for the image, as shown in the following example.
https://Exchange Server/ews/Exchange.asmx/s/GetUserPhoto?email=email address&size=size code
You should use the Autodiscover service GetUserSettings operation to retrieve the ExternalEwsUrl setting, which contains the URL of the Exchange Web Services (EWS) endpoint and the location of the Exchange.asmx HTTP handler that returns the user photos.
User photo sizes
The client application can specify one of the following size codes for the returned image:
Each size code indicates the height and width of the image in pixels. For example, the size code HR48x48 returns a 48-pixel high by 48-pixel wide image.
If the request specifies a size that is not available, the largest available photo will be returned. If no photo is stored on the Exchange server, the thumbnail image stored in Active Directory Domain Services (AD DS) will be returned.
The HR48x48 size code always returns the Active Directory thumbnail image if it is available.
The Exchange server returns an ETag header in the response to the request for a user photo. The ETag will remain the same for the user photo until the photo is updated. You can return this ETag to the server in the HTTPS GET request for the user photo in an If-None-Match header; if the photo has not changed since the last request, the server will respond with an HTTP 304 response that indicates that the image has not changed since the last request.
The Exchange server will return one of the HTTP responses listed in the following table.
An image is available for the specified email account and the binary image is the contents of the response.
The image has not changed since the ETag was returned to the client application.
No image is available for the specified email account.
July 16, 2012