Expand Minimize

GetUserPhoto operation

Exchange Server 2013

Find information about the GetUserPhoto EWS operation.

Last modified: November 30, 2012

Applies to: Exchange Online | Exchange Server 2013 | Office 365

In this article
Using the GetUserPhoto operation
GetUserPhoto operation request example: Get a user's photo
Successful GetUserPhoto operation response
GetUserPhoto operation error response
Additional resources

The GetUserPhoto operation gets a user photo from Active Directory Domain Services (AD DS).

This operation was introduced in Exchange Server 2013.

The RemoveContactFromImList operation is a simple operation that accepts a user's email address and the requested photo size and returns the photo stream in the response.

Note Note

EWS has both a SOAP and a REST-based operation to get user photos. For information about the REST interface, see How to: Get user photos by using EWS in Exchange.

GetUserPhoto operation SOAP headers

The GetUserPhoto operation can use the SOAP headers that are listed in the following table.

Header name

Element

Description

RequestVersion

RequestServerVersion

Identifies the schema version for the operation request. This header is applicable to a request.

ServerVersion

ServerVersionInfo

Identifies the version of the server that responded to the request. This header is applicable to a response.

The following example of a GetUserPhoto operation request shows how to get a user's photo. This example requests a user photo that is 48x48 pixels.

<?xml version="1.0" encoding="utf-8" ?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xmlns:xsd="http://www.w3.org/2001/XMLSchema"
               xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
               xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
               xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
   <soap:Header>
      <t:RequestServerVersion Version="Exchange2013"/>
   </soap:Header>
   <soap:Body>
      <m:GetUserPhoto>
         <m:Email>user1@contoso.com</m:Email>
         <m:SizeRequested>HR48x48</m:SizeRequested>
      </m:GetUserPhoto>
   </soap:Body>
</soap:Envelope>

The following elements are used in the request SOAP body:

The following example shows a successful response to a GetUserPhoto operation to get a user's photo.

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Header>
      <h:ServerVersionInfo MajorVersion="15" 
                           MinorVersion="0" 
                           MajorBuildNumber="556" 
                           MinorBuildNumber="8" 
                           Version="Exchange2013" 
                           xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" 
                           xmlns="http://schemas.microsoft.com/exchange/services/2006/types" 
                           xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
                           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
   </s:Header>
   <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
           xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <GetUserPhotoResponse ResponseClass="Success" 
                            xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">
         <ResponseCode>NoError</ResponseCode>
         <HasChanged>true</HasChanged>
         <PictureData>/9j/4AAQSkZJRgABAQEAYABgAAD/02</PictureData>
      </GetUserPhotoResponse>
   </s:Body>
</s:Envelope>

The following elements are used in the response SOAP body:

The SOAP envelope will not return an error code if an attempt is made to get a user photo for an email address that doesn't exist in the organization. A 500 HTTP status code will be returned in the response to indicate that the request was unsuccessful.

Show:
© 2014 Microsoft