Exchange Web Service find EmailMessage by “Message-ID” header

☆樱花仙子☆ 提交于 2019-12-10 17:56:26

问题


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.

I try to do something like this:

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

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

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


回答1:


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);


来源:https://stackoverflow.com/questions/33435207/exchange-web-service-find-emailmessage-by-message-id-header

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!