C#使用EWS创建日历项目,如何获取结果?

前端之家收集整理的这篇文章主要介绍了C#使用EWS创建日历项目,如何获取结果?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我基于这个网站 http://msdn.microsoft.com/en-us/library/dd633661%28v=EXCHG.80%29.aspx构建了一个应用程序
appointment.Subject = "Status Meeting";
appointment.Body = "The purpose of this meeting is to discuss status.";
appointment.Start = new DateTime(2009,3,1,9,0);
appointment.End = appointment.Start.AddHours(2);
appointment.Location = "Conf Room";
appointment.requiredAttendees.Add("user1@contoso.com");
appointment.requiredAttendees.Add("user2@contoso.com");
appointment.OptionalAttendees.Add("user3@contoso.com");
appointment.Save(SendInvitationsMode.SendToAllAndSaveCopy);

我如何返回XML结果“…< t:ItemId Id =”AAMkADk =“ChangeKey =”DwAAAB“/> …”所以我以后可以用它来删除或编辑日历项目!?!

微软在整个框架中做了一个上帝的工作,但他们真的忘记了这件小事吗?

我找到了一些(对我来说不合逻辑)解决方
http://blogs.msdn.com/b/exchangedev/archive/2010/02/25/determining-the-id-of-a-sent-message-by-using-extended-properties-with-the-ews-managed-api.aspx
我应该用它来解决这个问题吗?

干杯

解决方法

看起来你找到的解决方案并没有返回XMl结果,而且很好.解决方案正在做的是将唯一标识符作为ExtendedPropertyDefinition附加到电子邮件中.然后,在发送之后,解决方案将搜索“已发送邮件文件夹,以查找刚刚通过匹配发送电子邮件之前附加的唯一标识符发送的电子邮件的已保存副本.

然后写在博客上,

The following is the XML request that
is generated by calling FindItems in
the above code example.

<m:FindItem Traversal="Shallow"> 
   <m:ItemShape> 
      <t:BaseShape>IdOnly</t:BaseShape> 
      <t:AdditionalProperties> 
         <t:FieldURI FieldURI="item:Subject" /> 
         <t:ExtendedFieldURI PropertySetId="20b5c09f-7cad-44c6-bdbf-8fcbeea08544" PropertyName="MyExtendedPropertyName" PropertyType="String" /> 
      </t:AdditionalProperties> 
   </m:ItemShape> 
   <m:IndexedPageItemView MaxEntriesReturned="5" Offset="0" BasePoint="Beginning" /> 
   <m:Restriction> 
      <t:IsEqualTo> 
         <t:ExtendedFieldURI PropertySetId="20b5c09f-7cad-44c6-bdbf-8fcbeea08544" PropertyName="MyExtendedPropertyName" PropertyType="String" /> 
         <t:FieldURIOrConstant> 
            <t:Constant Value="MyExtendedPropertyValue" /> 
         </t:FieldURIOrConstant> 
      </t:IsEqualTo> 
   </m:Restriction> 
   <m:ParentFolderIds> 
      <t:DistinguishedFolderId Id="sentitems" /> 
   </m:ParentFolderIds> 
</m:FindItem>

请注意包含唯一标识符的XML标记.

<t:ExtendedFieldURI PropertySetId="20b5c09f-7cad-44c6-bdbf-8fcbeea08544" PropertyName="MyExtendedPropertyName" PropertyType="String" />

猜你在找的C#相关文章