Exchange ItemID不同于Outlook的GlobalAppointId插件
我遇到的问题是,使用Outlook FormRegion创建的Outlook任命的GlobalAppointId与使用EWS托管API时的ItemID不同 我正在创建一个Outlook加载项,允许用户将客户和项目信息添加到会议中。加载项还将约会ID和会议数据存储在数据库中,服务将定期检查ID以更新约会数据 好的,下面是我如何使用加载项:Exchange ItemID不同于Outlook的GlobalAppointId插件,outlook,exchange-server,outlook-addin,exchangewebservices,outlook-form,Outlook,Exchange Server,Outlook Addin,Exchangewebservices,Outlook Form,我遇到的问题是,使用Outlook FormRegion创建的Outlook任命的GlobalAppointId与使用EWS托管API时的ItemID不同 我正在创建一个Outlook加载项,允许用户将客户和项目信息添加到会议中。加载项还将约会ID和会议数据存储在数据库中,服务将定期检查ID以更新约会数据 好的,下面是我如何使用加载项: Outlook.AppointmentItem appointement = (Outlook.AppointmentItem)this.OutlookItem
Outlook.AppointmentItem appointement = (Outlook.AppointmentItem)this.OutlookItem;
appointement.Save();
string ExchangeID = appointement.GlobalAppointmentID;
此处,全局应用点ID为:0400000008200E00074C5B7101A82E008000000060CADC517255CE010000000000100000847A9CD89052DC49BA28DC8AAFBBB4BA
但EWS管理的API要求如下:
AamkAdvintJLZTG5LTIWYWMTNGY3M1HOWZIOTK3NZK1YQBGaaaaaaaaaaaefBMEZUR9aVSPHPMBwCysaa5HwPMransowsNKRCKAAAAXAL/AacySaa5HwPMransowsNKRCKAAAAXAA=
从服务绑定AppointmentItem。有一个选项可以解决这个问题,但只能使用自动生成的代理,而不能使用托管API
那么,有没有办法从EWS托管API搜索GlobalAppointementID或从Outlook加载项检索项目id?Outlook约会id包装外部(iCal)约会id。您需要解析它:ID可以用不同的方式表示。Outlook使用第一种形式,EWS使用第二种形式 要转换,请使用方法 以下是原始SOAP格式的请求/响应调用示例(通过这些示例,您应该能够使用API实现它们):
Outlook HexEntryID到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>
恩美
无误
将EWSID交换到Outlook HexEntryID:
<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>
无误
IPM.Appointment.Occurrence
定期约会,但有一个例外
正常的
2013-05-22T06:51:26Z
2013-05-22T06:52:20Z
2013-05-15T10:30:00Z
2013-05-15T11:00:00Z
真的
发生
IPM.OLE.CLASS.{00061055-0000-0000-C000-0000000000 46}
例外
正常的
2013-05-22T06:51:58Z
2013-05-22T06:52:20Z
2013-05-16T12:00:00Z
2013-05-16T12:30:00Z
真的
例外情况
[剪报]
已删除其他事件
[剪报]
将这两个ItemId的EWSID转换为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>
无误
无误
我不确定我是否在跟踪你。您是说GlobalAppointementID正在包装Exchange ItemID吗?我认为情况并非如此,因为ItemID比GlobalAppointementID长。我指的是一个约会id,它是在(例如)将iCal格式的传入会议请求转换为Outlook约会时设置的。原始约会id将包装在GlobalAppointementID属性中。如果你说的是一个输入id,那么Jan给出的答案应该对你有用。这很有效!或者至少是它的一个版本这里是如何将convert函数与EWS Mangaed API一起使用的只是一个说明,您使用Outlook中约会对象的EntryID转换为十六进制,使用类似以下内容:private static string getObjectedStringFromUID(string id){var buffer=new byte[id.Length/2];for(int i=0;i