ConvertId 操作ConvertId operation

查找有关ConvertId EWS 操作的信息。Find information about the ConvertId EWS operation.

ConvertId Exchange Web 服务(EWS)操作将项目和文件夹标识符转换为 exchange online、exchange Online 作为 Office 365 的一部分以及从 exchange Server 2013 开始的 exchange 内部部署版本之间的格式。The ConvertId Exchange Web Services (EWS) operation converts item and folder identifiers between formats that are accepted by Exchange Online, Exchange Online as part of Office 365, and on-premises versions of Exchange starting with Exchange Server 2013.

使用 ConvertId 操作Using the ConvertId operation

您可以使用ConvertId操作来转换以下标识符:You can convert the following identifiers by using the ConvertId operation:

  • Exchange 2007 的初始发布版本中的 EWS 标识符格式。The identifier format for EWS in the initial release version of Exchange 2007. 这由 EwsLegacyId IdFormat枚举中的枚举值表示。This is represented by the EwsLegacyId enumeration value in the IdFormat enumeration.

  • Exchange 2007 SP1 或 Exchange 2010 中的 EWS 的标识符格式。The identifier format for EWS in Exchange 2007 SP1 or Exchange 2010. 这由 EwsId IdFormat中的枚举值表示。This is represented by the EwsId enumeration value in IdFormat.

  • MAPI 标识符,如PR_ENTRYID属性中所示。The MAPI identifier, as in the PR_ENTRYID property. 这由 EntryId IdFormat枚举中的枚举值表示。This is represented by the EntryId enumeration value in the IdFormat enumeration.

  • 可用性日历事件标识符。The availability calendar event identifier. 这是PR_ENTRYID属性的十六进制编码表示形式。This is a hexadecimal-encoded representation of the PR_ENTRYID property. 这由 HexEntryId IdFormat中的枚举值表示。This is represented by the HexEntryId enumeration value in IdFormat.

  • Exchange 存储标识符。The Exchange store identifier. 这由 StoreId IdFormat中的枚举值表示。This is represented by the StoreId enumeration value in IdFormat. ConvertId操作不会将公用文件夹标识符从 EWS 标识符转换为存储标识符。The ConvertId operation does not convert public folder identifiers from the EWS identifier to the store identifier.

  • Outlook Web App 标识符。The Outlook Web App identifier. 这由 OwaId IdFormat中的枚举值表示This is represented by the OwaId enumeration value in IdFormat

    不支持将从此标识符创建的 Url 传递到 Outlook Web App。The passing of URLs that are created from this identifier to Outlook Web App is not supported. Outlook Web App 标识符适用于 Exchange 2007 和 Exchange 2010。The Outlook Web App identifier is applicable to Exchange 2007 and Exchange 2010. 适用于 Exchange Online 的 Outlook Web App 和从 Exchange Server 2013 开始的 Exchange 版本使用 EWS 标识符。Outlook Web App for Exchange Online and versions of Exchange starting with Exchange Server 2013 uses EWS identifiers.

在将公用文件夹标识符从 EWS 标识符转换为 Exchange Online 和 Exchange 2013 中的存储标识符时, ConvertId操作不会按预期工作。The ConvertId operation does not work as expected when converting public folder identifiers from the EWS identifier to the store identifier in Exchange Online and Exchange 2013. 您可以手动更新作为解决方法返回的标识符。You can manually update the identifier that is returned as a workaround. 若要手动更新标识符:To manually update the identifier:

  1. 在应用程序代码中,确定目标项目/文件夹是否位于公用文件夹中。In your application code, determine whether the target item/folder is in a public folder.

  2. 对 Base64 编码的标识符字符串进行解码。Decode the Base64-encoded identifier string.

  3. 验证类型 "字节(21字节)" 的值是否为7。Verify that the type byte (21st byte) has a value of 7. 值为7表示标识符的格式不正确。A value of 7 indicates that the identifier is in the incorrect format.

  4. 跳过前四个字节。Skip the first four bytes. 必须将其设置为零。They must be set to zero.

  5. 使用以下 GUID 更新接下来的16个字节:1A447390AA6611CD9BC800AA002FC45AUpdate the next 16 bytes with the following GUID: 1A447390AA6611CD9BC800AA002FC45A

  6. 更新值为9的下一个字节(类型为 byte)。Update the next byte (type byte) with a value of 9.

  7. 将标识符更改为 Base64 编码的字符串。Change the identifier to a Base64-encoded string.

备注

ConvertId操作验证给定的 SMTP 地址是否具有有效的格式。The ConvertId operation validates that a given SMTP address has a valid format. 该操作不确定 SMTP 地址是否表示有效邮箱。The operation does not determine whether an SMTP address represents a valid mailbox.

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

表1。ConvertId 操作 SOAP 标头Table 1. ConvertId operation SOAP headers

HeaderHeader 元素Element 说明Description
模拟Impersonation
ExchangeImpersonationExchangeImpersonation
标识客户端应用程序模拟的用户。Identifies the user whom the client application is impersonating. 这适用于请求。This is applicable to a request.
RequestVersionRequestVersion
RequestServerVersionRequestServerVersion
标识适用于请求的操作请求的架构版本。Identifies the schema version for the operation request This is applicable to a request.
ServerVersionServerVersion
ServerVersionInfoServerVersionInfo
标识响应请求的服务器版本。Identifies the version of the server that responded to the request. 这适用于响应。This is applicable to a response.

ConvertId 操作请求示例ConvertId operation request example

以下示例的ConvertId请求显示如何从 EWS 标识符转换为 Outlook Web App 标识符。The following example of a ConvertId request shows how to convert from an EWS identifier to an Outlook Web App identifier.

必须将 SOAP 标头中的RequestServerVersion元素设置为 Exchange2007_SP1 或更高版本,才能使此操作生效。The RequestServerVersion element in the SOAP header must be set to Exchange2007_SP1 or later for this operation to work.

备注

项目标识符已缩短,以保持可读性。The item identifier has been shortened to preserve readability.

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
               xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types">
  <soap:Header>
    <t:RequestServerVersion Version="Exchange2010"/>
  </soap:Header>
  <soap:Body>
    <ConvertId xmlns="https://schemas.microsoft.com/exchange/services/2006/messages"
               xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types"
               DestinationFormat="OwaId">
      <SourceIds>
        <t:AlternateId Format="EwsId" Id="AAMkAGZhN2IxYTA0LWNiNzItN="
                       Mailbox="user1@example.com"/>
      </SourceIds>
    </ConvertId>
  </soap:Body>
</soap:Envelope>

ConvertId 操作响应示例ConvertId operation response example

下面的示例演示对ConvertId请求的成功响应。The following example shows a successful response to a ConvertId request. 此响应示例包含 Outlook Web App 标识符。This response example contains an Outlook Web App identifier.

备注

Outlook Web App 标识符已缩短,以保持可读性。The Outlook Web App identifier has been shortened to preserve readability.

<?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="1" 
                         MajorBuildNumber="191" MinorBuildNumber="0" 
                         Version="Exchange2010" 
                         xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types" />
  </soap:Header>
  <soap:Body>
    <ConvertIdResponse xmlns="https://schemas.microsoft.com/exchange/services/2006/messages">
      <ResponseMessages>
        <ConvertIdResponseMessage ResponseClass="Success">
          <ResponseCode>NoError</ResponseCode>
          <AlternateId xsi:type="t:AlternateIdType" Format="OwaId" Id="RgAAAAAS2%2" 
                         Mailbox="user@example.com" />
        </ConvertIdResponseMessage>
      </ResponseMessages>
    </ConvertIdResponse>
  </soap:Body>
</soap:Envelope>

ConvertId 操作错误响应示例ConvertId operation error response example

下面的示例演示对包含错误类型的标识符格式的请求的响应。The following example shows the response to a request that contains the wrong type of identifier format.

<?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>
    <ServerVersionInfo MajorVersion="8" MinorVersion="1" 
                       MajorBuildNumber="206" MinorBuildNumber="0"
                       Version="Exchange2010" 
                       xmlns="https://schemas.microsoft.com/exchange/services/2006/types" />
  </soap:Header>
  <soap:Body>
    <ConvertIdResponse xmlns="https://schemas.microsoft.com/exchange/services/2006/messages">
      <ResponseMessages>
        <ConvertIdResponseMessage ResponseClass="Error">
          <MessageText>Id is malformed.</MessageText>
          <ResponseCode>ErrorInvalidIdMalformed</ResponseCode>
          <DescriptiveLinkKey>0</DescriptiveLinkKey>
        </ConvertIdResponseMessage>
      </ResponseMessages>
    </ConvertIdResponse>
  </soap:Body>
</soap:Envelope>

版本差异Version differences

在 Exchange 2007 和 Exchange 2007 Service Pack 1 (SP1)的初始发行版之间更改了 EWS 标识符格式。The EWS identifier format changed between the initial release version of Exchange 2007 and Exchange 2007 Service Pack 1 (SP1). Exchange Online 作为 Office 365、Exchange Online 和 Exchange 内部部署版本的一部分从 exchange 2010 开始使用 Exchange 2007 SP1 使用的相同标识符格式。Exchange Online as part of Office 365, Exchange Online, and on-premises versions of Exchange starting with Exchange 2010 use the same identifier format that Exchange 2007 SP1 uses.

ConvertId操作将公用文件夹标识符从 EWS 标识符转换为 exchange 2007 和 exchange 2010 中的存储标识符。The ConvertId operation converts public folder identifiers from the EWS identifier to the store identifier in Exchange 2007 and Exchange 2010.

另请参阅See also