ResolveNames 操作

ResolveNames 操作可解析不明确的电子邮件地址和显示名称。

使用 ResolveNames 操作

此操作可用于验证别名并将显示名称解析为相应的邮箱用户。 如果存在不明确的名称, 则 ResolveNames 操作响应会提供有关每个邮箱用户的信息,以便客户端应用程序可以解析名称。

备注

ResolveNames 响应最多返回 100 个候选项。 返回的 100 个候选项是在查找操作中遇到的前 100 个候选项。

具有前缀路由类型的Email地址(如 smtp 或 sip)保存在多值数组中。 在未解析名称的开头添加路由类型(如“sip:User1@Contoso.com”)时,ResolveNames 操作对该数组的每个值执行部分匹配。 如果未指定路由类型, ResolveNames 将默认为 smtp 的路由类型,将其与主 smtp 地址属性匹配,而不搜索多值数组。

在单个请求中只能指定一个不明确的名称。 首先搜索 Active Directory,然后搜索用户的联系人文件夹。 用户联系人文件夹中的已解析条目具有非 null ItemId 属性,该属性随后可在 GetItem 请求中使用。 如果它是专用通讯组列表的 ID,则可以在 ExpandDL 操作中使用。 如果 ReturnFullContactData 属性设置为 true,则使用 ResolveNames 操作找到的 Active Directory 条目将返回描述 联系人的其他属性。 ReturnFullContactData 属性不会影响从用户的联系人文件夹为联系人和专用通讯组列表返回的数据。

ResolveNames 请求示例

说明

以下 ResolveNames 请求示例演示如何解析 User 的条目。

代码

<?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">
  <soap:Body>
    <ResolveNames xmlns="https://schemas.microsoft.com/exchange/services/2006/messages"
                  xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types"
                  ReturnFullContactData="true">
      <UnresolvedEntry>User2</UnresolvedEntry>
    </ResolveNames>
  </soap:Body>
</soap:Envelope>

Comments

对此请求的响应将返回以“Jo”或“Mi”开头的所有条目。返回的项是公共邮箱、公共和专用通讯组列表以及联系人。

注意

仅搜索默认个人联系人文件夹中的联系人。

以下是 ResolveNames 请求的可能结果:

  • 不包含解析实体的响应将返回等于 ErrorResponseClass 属性值。 MessageText 元素将包含“找不到任何结果”。

  • 包含单个解析实体的响应将返回等于 Success的 ResponseClass 属性值。

  • 包含多个可能实体的响应将返回等于 WarningResponseClass 属性值。 在这种情况下,无法将实体解析为唯一标识。 MessageText 元素将包含“找到多个结果”。

请求元素

请求中使用以下元素:

成功的 ResolveNames 操作响应示例

说明

以下示例显示了 对 ResolveNames 请求的成功 响应。

代码

<?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>
    <ResolveNamesResponse xmlns:m="https://schemas.microsoft.com/exchange/services/2006/messages" 
                          xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types" 
                          xmlns="https://schemas.microsoft.com/exchange/services/2006/messages">
      <m:ResponseMessages>
        <m:ResolveNamesResponseMessage ResponseClass="Success">
          <m:ResponseCode>NoError</m:ResponseCode>
          <m:ResolutionSet TotalItemsInView="1" IncludesLastItemInRange="true">
            <t:Resolution>
              <t:Mailbox>
                <t:Name>User2</t:Name>
                <t:EmailAddress>User2@example.com</t:EmailAddress>
                <t:RoutingType>SMTP</t:RoutingType>
                <t:MailboxType>Mailbox</t:MailboxType>
              </t:Mailbox>
              <t:Contact>
                <t:DisplayName>User2</t:DisplayName>
                <t:EmailAddresses>
                  <t:Entry Key="EmailAddress1">SMTP:User2@example.com</t:Entry>
                </t:EmailAddresses>
                <t:ContactSource>ActiveDirectory</t:ContactSource>
              </t:Contact>
            </t:Resolution>
          </m:ResolutionSet>
        </m:ResolveNamesResponseMessage>
      </m:ResponseMessages>
    </ResolveNamesResponse>
  </soap:Body>
</soap:Envelope>

成功的 ResolveNames 响应元素

响应中使用以下元素:

ResolveNames 操作错误响应

说明

以下示例显示了 对 ResolveNames 请求的错误 响应。 此错误是由尝试解析无法解析的名称引起的。

代码

<?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>
    <ResolveNamesResponse xmlns:m="https://schemas.microsoft.com/exchange/services/2006/messages" 
                          xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types" 
                          xmlns="https://schemas.microsoft.com/exchange/services/2006/messages">
      <m:ResponseMessages>
        <m:ResolveNamesResponseMessage ResponseClass="Error">
          <m:MessageText>No results were found.</m:MessageText>
          <m:ResponseCode>ErrorNameResolutionNoResults</m:ResponseCode>
          <m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
        </m:ResolveNamesResponseMessage>
      </m:ResponseMessages>
    </ResolveNamesResponse>
  </soap:Body>
</soap:Envelope>

错误响应元素

错误响应中使用以下元素:

另请参阅

ExpandDL 操作

使用名称解析