GetUserPhoto 操作

GetUserPhoto EWS 操作に関する情報を検索します。

GetUserPhoto 操作は、Active Directory Domain Services (AD DS) からユーザー写真を取得します。

この操作は Exchange Server 2013 で導入されました。

GetUserPhoto 操作の使用

RemoveContactFromImList 操作は、ユーザーのメール アドレスと要求された写真サイズを受け入れ、応答で写真ストリームを返す単純な操作です。

注:

EWS には、ユーザーの写真を取得するための SOAP と REST ベースの操作の両方があります。 REST インターフェイスの詳細については、「 Exchange で EWS を使用してユーザー写真を取得する」を参照してください。

GetUserPhoto 操作 SOAP ヘッダー

GetUserPhoto 操作では、次の表に示す SOAP ヘッダーを使用できます。

ヘッダー名 要素 説明
RequestVersion
RequestServerVersion
操作要求のスキーマ バージョンを識別します。 このヘッダーは要求に適用されます。
ServerVersion
ServerVersionInfo
要求に応答したサーバーのバージョンを識別します。 このヘッダーは、応答に適用できます。

GetUserPhoto 操作要求の例: ユーザーの写真を取得する

GetUserPhoto 操作要求の次の例は、ユーザーの写真を取得する方法を示しています。 次の使用例は、48 x 48 ピクセルのユーザー写真を要求します。

<?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="https://schemas.microsoft.com/exchange/services/2006/types"
               xmlns:m="https://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>

要求 SOAP 本文では、次の要素が使用されます。

GetUserPhoto 操作の応答に成功しました

次の例は、ユーザーの写真を 取得するための GetUserPhoto 操作に対する正常な応答を示しています。

<?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="https://schemas.microsoft.com/exchange/services/2006/types" 
                           xmlns="https://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="https://schemas.microsoft.com/exchange/services/2006/messages">
         <ResponseCode>NoError</ResponseCode>
         <HasChanged>true</HasChanged>
         <PictureData>/9j/4AAQSkZJRgABAQEAYABgAAD/02</PictureData>
      </GetUserPhotoResponse>
   </s:Body>
</s:Envelope>

応答 SOAP 本文では、次の要素が使用されます。

GetUserPhoto 操作エラー応答

組織内に存在しないメール アドレスのユーザー写真を取得しようとした場合、SOAP エンベロープはエラー コードを返しません。 要求が失敗したことを示す 500 HTTP 状態コードが応答で返されます。

関連項目