GetUserOofSettings 操作GetUserOofSettings operation

GetUserOofSettings操作将获取邮箱用户的外出(OOF)设置和邮件。The GetUserOofSettings operation gets a mailbox user's Out of Office (OOF) settings and messages.

SOAP 标头SOAP Headers

GetUserOofSettings操作可以使用下表中列出和描述的 SOAP 标头。The GetUserOofSettings operation can use the SOAP headers that are listed and described in the following table.

HeaderHeader 元素Element 说明Description
模拟Impersonation
ExchangeImpersonationExchangeImpersonation
标识客户端应用程序模拟的用户。Identifies the user whom the client application is impersonating.
ServerVersionServerVersion
ServerVersionInfoServerVersionInfo
标识响应请求的服务器版本。Identifies the version of the server that responded to the request.

使用 GetUserOofSettings 操作Using the GetUserOofSettings Operation

GetUserOofSettings操作提供对用户的 OOF 设置的访问权限。The GetUserOofSettings operation provides access to a user's OOF settings. 用户由用户的电子邮件地址标识。A user is identified by the user's email address. 如果 OOF 邮件为 null 且启用了 OOF 功能,则不会发送 OOF 邮件。If the OOF message is null and OOF is enabled, no OOF message is sent.

重要

如果 OOF 邮件是由 MicrosoftOfficeOutlook 设置的,则此操作将返回 HTML 格式的 OOF 邮件。If the OOF messages are set by MicrosoftOfficeOutlook, this operation will return the OOF messages in HTML format.

GetUserOofSettings 请求示例GetUserOofSettings request example

DescriptionDescription

下面的示例演示一个GetUserOofSettings请求,该请求获取单个用户的 OOF 信息。The following example shows a GetUserOofSettings request that gets a single user's OOF information.

代码Code

<?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/">
  <soap:Body>
    <GetUserOofSettingsRequest xmlns="https://schemas.microsoft.com/exchange/services/2006/messages">
      <Mailbox xmlns ="https://schemas.microsoft.com/exchange/services/2006/types">
        <Address>User1@example.com</Address>
      </Mailbox>
    </GetUserOofSettingsRequest>
  </soap:Body>
</soap:Envelope>

Request 元素Request elements

请求中使用以下元素:The following elements are used in the request:

成功的 GetUserOofSettings 响应示例Successful GetUserOofSettings response example

DescriptionDescription

以下示例显示了带有 OOF 邮件的已禁用 OOF 状态。The following example shows a disabled OOF state with the OOF messages.

代码Code

<?xml version="1.0" encoding="utf-8" ?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
               xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Header>
    <t:ServerVersionInfo MajorVersion="8" MinorVersion="0" MajorBuildNumber="685" MinorBuildNumber="8" 
                         xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types" />
  </soap:Header>
  <soap:Body>
    <GetUserOofSettingsResponse xmlns="https://schemas.microsoft.com/exchange/services/2006/messages">
      <ResponseMessage ResponseClass="Success">
        <ResponseCode>NoError</ResponseCode>
      </ResponseMessage>
      <OofSettings xmlns="https://schemas.microsoft.com/exchange/services/2006/types">
        <OofState>Disabled</OofState>
        <ExternalAudience>All</ExternalAudience>
        <Duration>
          <StartTime>2006-11-03T23:00:00</StartTime>
          <EndTime>2006-11-04T23:00:00</EndTime>
        </Duration>
        <InternalReply>
          <Message>I am out of office. This is my internal reply.</Message>
        </InternalReply>
        <ExternalReply>
          <Message>I am out of office. This is my external reply.</Message>
        </ExternalReply>
      </OofSettings>
      <AllowExternalOof>All</AllowExternalOof>
    </GetUserOofSettingsResponse>
  </soap:Body>
</soap:Envelope>

成功的 GetUserOofSettings 响应元素Successful GetUserOofSettings response elements

响应中使用以下元素:The following elements are used in the response:

GetUserOofSettings 错误响应示例GetUserOofSettings Error response example

DescriptionDescription

下面的示例演示尝试访问另一个用户的 OOF 信息时导致的错误响应。The following example shows an error response caused by an attempt to access another user's OOF information.

代码Code

<?xml version="1.0" encoding="utf-8" ?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
               xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Header>
    <t:ServerVersionInfo MajorVersion="8" MinorVersion="0" MajorBuildNumber="685" MinorBuildNumber="8" 
                         xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types" />
  </soap:Header>
  <soap:Body>
    <soap:Fault>
      <faultcode>soap:Client</faultcode>
      <faultstring>Microsoft.Exchange.Data.Storage.AccessDeniedException: User is not mailbox owner. User = S-1-5-21-3642464542-282065186-3871681729-1155, MailboxGuid = S-1-5-21-3642464542-282065186-3871681729-1156 ---> User is not mailbox owner. </faultstring>
      <faultactor>https://CAS01.example.com/EWS/Exchange.asmx</faultactor>
      <detail>
        <ErrorCode xmlns="https://schemas.microsoft.com/exchange/services/2006/messages">-2146233088</ErrorCode>
      </detail>
    </soap:Fault>
  </soap:Body>
</soap:Envelope>

另请参阅See also