EWS托管API - 用于电子邮件的IMAP UID的等效项? [英] EWS Managed API-Equivalent of IMAP UID for an email message?

查看:158
本文介绍了EWS托管API - 用于电子邮件的IMAP UID的等效项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写一个可以使用缓存邮件ID的应用程序,以便稍后从邮箱中检索邮件内容。 系统需要能够使用IMAP或Exchange Web服务托管API。 我开始测试IMAP实现中的
,我可以获得消息的UID(如
RFC 3501
)。 使用该UID,我可以返回并正确检索邮件。 但是在EWSMA方面,我似乎无法找出一个等效的消息ID。 在IMAP世界中,UID是一个整数,但我从EmailMessage
获得的任何消息ID都是Guids。 我想要做的是调用类似" EmailMessage .Bind(m_exchange,
new < span style ="color:#2b91af; font-size:small"> ItemId " 8" ));"
绑定到当前邮箱中具有UID 8的邮件。 

I'm trying to write an app that can use a cached message ID to retrieve the contents of the message from a mailbox at a later time.  The system needs to be able to work with either IMAP or Exchange web services managed API.  I started with testing out an IMAP implementation, and I can get the UID of a message (as defined in RFC 3501).  Using that UID, I can go back and retrieve a message just fine.  On the EWSMA side though, I can't seem to figure out an equivalent message ID.  In the IMAP world, the UID is an integer, but any message IDs I get off an EmailMessage are Guids.  What I want to be able to do is call something like "EmailMessage.Bind(m_exchange, newItemId("8"));" to bind to a message with UID 8 in the current mailbox. 

有没有办法转换这样的UID,或者我可以使用这两种方法中的一种/两种来唯一地识别消息? 我想,我的另一种方法是存储IMAP UID或交换消息ID,如果协议发生变化,则无效
并根据我已经知道的其他标头重新搜索。

Is there a way to convert a UID like this, or a way that I could uniquely identify a message using either/both of these methods?  My alternative, I suppose, is to store either the IMAP UID or exchange message ID, and if the protocol changes, invalidate and re-search based on the other headers I already know about.

推荐答案

在EWS中唯一能用于获取消息(使用Bind或GetItem)的是ewsId。获取EWSid的唯一方法是通过EWS,因此如果您通过IMAP收到消息,您将无法访问EWSId(或任何其他扩展
Mapi属性)。

The only thing that will work in EWS to get a Message (using Bind or GetItem) is the ewsId. The only way of getting the EWSid is though EWS so if your getting a Message via IMAP you won't be able to able to access the EWSId (or any of the other Extended Mapi properties).

EWS有一个ConvertID操作
http://msdn.microsoft.com/en-us/library/exchange/bb799665(v=exchg.150).aspx
但这只允许在MAPI,EWS和OWA标识符之间进行转换。可以在IMAP和EWS会话之间互换的唯一ID是Internet消息
Id。因此,您可以根据该ID搜索消息,然后访问它,例如。

EWS has a ConvertID operation http://msdn.microsoft.com/en-us/library/exchange/bb799665(v=exchg.150).aspx but this will only allow converting between MAPI, EWS and OWA identifiers. The only Id that would be interchangeable between and IMAP and EWS session would be the Internet Message Id. So you could search for the Message based on that Id and then access it eg.

ItemView ivew = new ItemView(1); service.TraceEnabled = true; ExtendedPropertyDefinition PidTagInternetMessageId = new ExtendedPropertyDefinition(4149, MapiPropertyType.String); SearchFilter sf = new SearchFilter.IsEqualTo(PidTagInternetMessageId, MessageID); FindItemsResults<Item> iCol = service.FindItems(WellKnownFolderName.Inbox, sf, ivew); foreach (Item item in iCol.Items) {
Console.WriteLine(item.Subject); }

 如果您要存储ewsId,请小心,因为如果邮件在文件夹之间移动,这些会发生变化。

 Be careful if you are going to store the ewsId because these change if the message is moved between folders.

干杯zh
Glen

Cheers
Glen


这篇关于EWS托管API - 用于电子邮件的IMAP UID的等效项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆