本文介绍了Exchange Web服务通过“消息ID"找到EmailMessage.标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Java EWS库,并尝试回复一些消息.主要问题是-如果我只知道邮件的"Message-ID"标头的值,如何在文件夹或邮箱中查找EmailMessage.

I'm using the Java EWS library and try to reply to some messages. The main question is - how to find EmailMessage in folder or in mailbox if I only know value of "Message-ID" header of my message.

我尝试做这样的事情:

ExtendedPropertyDefinition p = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.InternetHeaders, "Message-ID", MapiPropertyType.String)

myfolder.findItems(new SearchFilter.IsEqualTo(p, "<1031208507.471.1446200157453.JavaMail.test>"), new ItemView(1))

但是结果集是空的!你能帮助我吗?一些Java或C#解决方案?

But result set is aleays empty! Can you help me? Some Java or C# solutions?

推荐答案

您可以改为使用常规(未扩展)属性InternetMessageId:

You could go for the regular (not extended) property InternetMessageId instead:

ItemView view = new ItemView(1);

String searchstring = "<1031208507.471.1446200157453.JavaMail.test>";
SearchFilter.IsEqualTo filter = 
   new SearchFilter.IsEqualTo(EmailMessageSchema.InternetMessageId, searchstring);

FindItemsResults<Item> findResults = 
   service.FindItems(WellKnownFolderName.Inbox, filter, view);

这篇关于Exchange Web服务通过“消息ID"找到EmailMessage.标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 11:18