当前位置:  开发笔记 > 前端 > 正文

通过EWS发送邮件时如何获取保存发送副本的ItemId

如何解决《通过EWS发送邮件时如何获取保存发送副本的ItemId》经验,为你挑选了1个好方法。

EWS文档说,要发送消息并将副本保存到“已发送邮件”文件夹中,应将CreateItem操作与MessageDisposition值为SendAndSaveCopy一起使用。

   
     
       
     
     
       
         Company Soccer Team
         Are you interested in joining?
         
           
             sadie@contoso.com 
           
         
       
     
   

成功时,“服务器用CreateItemResponse消息响应CreateItem请求,该消息包括ResponseCode值NoError(表示电子邮件已成功创建)和新创建的消息的ItemId。”

在Office 365上使用EWS,这几乎可以成功进行。消息已发送,副本已保存到“已发送邮件...”,但响应中返回已保存副本的ItemId :

   
     
       
         NoError
         
       
     
   

有没有一种方法可以指导EWS服务器实际返回已保存副本的ItemId?另外,发送完成后查找保存副本的首选机制是什么?



1> dkarp..:

显然,该文档是错误的或不适用的。这篇MSDN博客文章符合我的经验:SendAndSaveCopy CreateItem请求没有返回ItemId 。它提出以下建议:

Simply stamp your e-mail message with a custom extended property when you create the message, and then use that extended property to find the message in the Sent Items folder after it has been sent.

评论者建议不要使用昂贵的FindItems-with-SearchFilter调用来查找自定义属性标记的保存副本,而应该执行以下操作:

1. Set your extended prop.

2. Do a FindItem with NO restriction against the sent items folder, SORTED by creation date descending with a indexed page view of about 5. Include your extended prop in the PropertySet.

3. Iterate across the results looking for your extended prop.

推荐阅读
TXCWB_523
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有