Outlook插件的Exchange ItemID与GlobalAppointmentID不同



我遇到的问题是,使用Outlook FormRegion创建的Outlook约会的GlobalAppointmentID与使用EWS Managed API时的ItemID不同。

我正在创建一个Outlook插件,允许用户在会议中添加客户和项目信息。该插件还将预约ID和会议数据保存在数据库中,服务会定期检查预约ID,更新预约数据。

下面是我使用插件的方法:

Outlook.AppointmentItem appointement = (Outlook.AppointmentItem)this.OutlookItem;
appointement.Save();
string ExchangeID = appointement.GlobalAppointmentID;

这里的GlobalAppointmentID为:040000008200E00074C5B7101A82E0080000000060CADC517255CE01000000000000000010000000847A9CD89052DC49BA28DC8AAFBBB4BA

但是EWS管理的API期望这样的东西:AAMkADViNTJlZTg5LTIwYWMtNGY3My1hOWZiLTZiOTM3OTk3Nzk1YQBGAAAAAAAEfbmEhAMsRZur9AvsphPMBwCysaa5HwPMRanSoWSnKrckAAAAXAL/AACysaa5HwPMRanSoWSnKrckAAAAXCxwAAA =

从服务中绑定一个appointment。有一个选项可以解决这个问题,但只能使用自动生成的代理,而不能使用托管API链接到代理解决方案

那么是否有一种方法可以从EWS Managed API搜索globalappointment entid或从Outlook AddIn检索ItemID?

id可以用不同的方式表示。Outlook使用第一种形式,EWS使用第二种。

要转换,使用ConvertID方法。

以下是原始SOAP格式的请求/响应调用示例(有了这些示例,您应该能够使用API实现它们):
Outlook HexEntryID to Exchange EWSID

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:mes="http://schemas.microsoft.com/exchange/services/2006/messages">
   <soapenv:Header>
      <typ:RequestServerVersion Version="Exchange2007_SP1"/>
      <typ:MailboxCulture>en-US</typ:MailboxCulture>
   </soapenv:Header>
   <soapenv:Body>
      <mes:ConvertId DestinationFormat="EwsId">
         <mes:SourceIds>
            <typ:AlternateId Format="HexEntryId" Id="0000000068C940C[snip]63136C3D0000" Mailbox="user@domain.com"/>
         </mes:SourceIds>
      </mes:ConvertId>
   </soapenv:Body>
</soapenv:Envelope>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Header>
      <h:ServerVersionInfo MajorVersion="14" MinorVersion="0" MajorBuildNumber="722" MinorBuildNumber="0" Version="Exchange2010" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
   </s:Header>
   <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <m:ConvertIdResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
         <m:ResponseMessages>
            <m:ConvertIdResponseMessage ResponseClass="Success">
               <m:ResponseCode>NoError</m:ResponseCode>
               <m:AlternateId xsi:type="t:AlternateIdType" Format="EwsId" Id="AQMkADkyZTQxNjUzL[snip]YxNsPQAAAA==" Mailbox="user@domain.com"/>
            </m:ConvertIdResponseMessage>
         </m:ResponseMessages>
      </m:ConvertIdResponse>
   </s:Body>
</s:Envelope>

向Outlook交换EWSID:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:mes="http://schemas.microsoft.com/exchange/services/2006/messages">
   <soapenv:Header>
      <typ:RequestServerVersion Version="Exchange2007_SP1"/>
   </soapenv:Header>
   <soapenv:Body>
      <mes:ConvertId DestinationFormat="HexEntryId">
         <mes:SourceIds>
            <typ:AlternateId Format="EwsId" Id="AQMkADkyZTQxNjUzLTcwZTQtNGRlNS04M2VmLWMxYmIBNWJi[snip]YxNsPQAAAA==" Mailbox="user@domain.com"/>
         </mes:SourceIds>
      </mes:ConvertId>
   </soapenv:Body>
</soapenv:Envelope>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Header>
      <h:ServerVersionInfo MajorVersion="14" MinorVersion="0" MajorBuildNumber="722" MinorBuildNumber="0" Version="Exchange2010" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
   </s:Header>
   <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <m:ConvertIdResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
         <m:ResponseMessages>
            <m:ConvertIdResponseMessage ResponseClass="Success">
               <m:ResponseCode>NoError</m:ResponseCode>
               <m:AlternateId xsi:type="t:AlternateIdType" Format="HexEntryId" Id="0000000068C940[snip]136C3D0000" Mailbox="user@domain.com"/>
            </m:ConvertIdResponseMessage>
         </m:ResponseMessages>
      </m:ConvertIdResponse>
   </s:Body>
</s:Envelope>

请注意,当使用重复约会和事件时,使用这两种类型的ID是有区别的:
如果EWS ID每次都不同,那么Outlook十六进制条目ID对于所有条目都是相同的:

有一个例外的重复事件的

FindItem响应—注意不同的itemid:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Header>
      <h:ServerVersionInfo MajorVersion="14" MinorVersion="0" MajorBuildNumber="722" MinorBuildNumber="0" Version="Exchange2010" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
   </s:Header>
   <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <m:FindItemResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
         <m:ResponseMessages>
            <m:FindItemResponseMessage ResponseClass="Success">
               <m:ResponseCode>NoError</m:ResponseCode>
               <m:RootFolder TotalItemsInView="10" IncludesLastItemInRange="true">
                  <t:Items>
                     <t:CalendarItem>
                        <t:ItemId Id="AAMkADkyZTQxNjUzLTcwZTQtNGRlNS04M2VmLWMxYmJiNWJiNTBlNgFRAAgI0B8WRv2AAEYAAAAAgq3iY5OVdkmtnHS/lxCbwgcAhKYXWHH/akCFAFNVQGZiCgAAAAAAIQAAhKYXWHH/akCFAFNVQGZiCgACKa9YrQAAEA==" ChangeKey="DwAAABYAAACEphdYcf9qQIUAU1VAZmIKAAIpr2i3"/>
                        <t:ItemClass>IPM.Appointment.Occurrence</t:ItemClass>
                        <t:Subject>Recurring appointment with one exception</t:Subject>
                        <t:Sensitivity>Normal</t:Sensitivity>
                        <t:DateTimeCreated>2013-05-22T06:51:26Z</t:DateTimeCreated>
                        <t:LastModifiedTime>2013-05-22T06:52:20Z</t:LastModifiedTime>
                        <t:Start>2013-05-15T10:30:00Z</t:Start>
                        <t:End>2013-05-15T11:00:00Z</t:End>
                        <t:IsRecurring>true</t:IsRecurring>
                        <t:CalendarItemType>Occurrence</t:CalendarItemType>
                     </t:CalendarItem>
                     <t:CalendarItem>
                        <t:ItemId Id="AAMkADkyZTQxNjUzLTcwZTQtNGRlNS04M2VmLWMxYmJiNWJiNTBlNgFRAAgI0B/fcWdAAEYAAAAAgq3iY5OVdkmtnHS/lxCbwgcAhKYXWHH/akCFAFNVQGZiCgAAAAAAIQAAhKYXWHH/akCFAFNVQGZiCgACKa9YrQAAEA==" ChangeKey="DwAAABYAAACEphdYcf9qQIUAU1VAZmIKAAIpr2i3"/>
                        <t:ItemClass>IPM.OLE.CLASS.{00061055-0000-0000-C000-000000000046}</t:ItemClass>
                        <t:Subject>The exception</t:Subject>
                        <t:Sensitivity>Normal</t:Sensitivity>
                        <t:DateTimeCreated>2013-05-22T06:51:58Z</t:DateTimeCreated>
                        <t:LastModifiedTime>2013-05-22T06:52:20Z</t:LastModifiedTime>
                        <t:Start>2013-05-16T12:00:00Z</t:Start>
                        <t:End>2013-05-16T12:30:00Z</t:End>
                        <t:IsRecurring>true</t:IsRecurring>
                        <t:CalendarItemType>Exception</t:CalendarItemType>
                     </t:CalendarItem>
                     [snip]
                     Other occurrences removed
                     [snip]
                  </t:Items>
               </m:RootFolder>
            </m:FindItemResponseMessage>
         </m:ResponseMessages>
      </m:FindItemResponse>
   </s:Body>
</s:Envelope>

将EWSID转换为这两个itemid的HexEntryID结果为

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Header>
      <h:ServerVersionInfo MajorVersion="14" MinorVersion="0" MajorBuildNumber="722" MinorBuildNumber="0" Version="Exchange2010" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
   </s:Header>
   <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <m:ConvertIdResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
         <m:ResponseMessages>
            <m:ConvertIdResponseMessage ResponseClass="Success">
               <m:ResponseCode>NoError</m:ResponseCode>
               <m:AlternateId xsi:type="t:AlternateIdType" Format="HexEntryId" Id="0000000082ADE26393957649AD9C74BF97109BC2070084A6175871FF6A40850053554066620A000000000021000084A6175871FF6A40850053554066620A000229AF58AD0000" Mailbox="user@domain.com"/>
            </m:ConvertIdResponseMessage>
         </m:ResponseMessages>
      </m:ConvertIdResponse>
   </s:Body>
</s:Envelope>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Header>
      <h:ServerVersionInfo MajorVersion="14" MinorVersion="0" MajorBuildNumber="722" MinorBuildNumber="0" Version="Exchange2010" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
   </s:Header>
   <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <m:ConvertIdResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
         <m:ResponseMessages>
            <m:ConvertIdResponseMessage ResponseClass="Success">
               <m:ResponseCode>NoError</m:ResponseCode>
               <m:AlternateId xsi:type="t:AlternateIdType" Format="HexEntryId" Id="0000000082ADE26393957649AD9C74BF97109BC2070084A6175871FF6A40850053554066620A000000000021000084A6175871FF6A40850053554066620A000229AF58AD0000" Mailbox="user@domain.com"/>
            </m:ConvertIdResponseMessage>
         </m:ResponseMessages>
      </m:ConvertIdResponse>
   </s:Body>
</s:Envelope>

Outlook约会id封装外部(iCal)约会id。您需要解析它:http://msdn.microsoft.com/en-us/library/ee157690(v=exchg.80).aspx

相关内容

  • 没有找到相关文章

最新更新