Export (0) Print
Expand All

4 Protocol Examples

The following example of the GetUserPhoto operation, as described in section 3.2.5.1, shows how the client retrieves a photo by using SOAP. This example requests a photo 96 pixels high and 96 pixels wide associated with the email address "user1@contoso.com".

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

The server sends the following successful response to the client. The value of the PictureData element that contains the returned binary information has been truncated for readability.

<?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="545"
              MinorBuildNumber="5" 
              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>/9jDBkSEw8UHRofHh0aHBwgJC4</PictureData>
    </GetUserPhotoResponse>
  </s:Body>
</s:Envelope>

Example using REST interface

Request (HTTP GET)

https://outlook.office365.com/ews/Exchange.asmx/s/GetUserPhoto?email=user1%40contoso.com&size=HR120x120

Response

Headers

Content-Typeimage/jpeg

ETag"889B7442"

Body (payload)

<binary JPEG image>

Show:
© 2014 Microsoft