加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-15 04:29:36 所属栏目:百科 来源:网络整理
导读:我基于这个网站 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 Da
我基于这个网站 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" />

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读