Programmatically accessing archived mails in an Exchange folder

泄露秘密 提交于 2021-02-11 12:15:29

问题


I am trying to access all the mails in a given folder via the ActiveX interface to Outlook 2013. I use the message API (MAPI) of Outlook to get the desired folder object.

However, when I go through all the items of this folder object, many messages are missing. Indeed, there are messages that are on the MS Exchange server that are not synchronized with Outlook because they are too old. (In Outlook, the folder ends with a link named 'Click here to view more on Microsoft Exchange'. When clicking on the link, the missing messages appear in Outlook. However they are not added to the folder object after this operation.)

How to access those messages? Is it possible via the Outlook ActiveX interface? If not, is there an equivalent interface to the MS Exchange server?


回答1:


To access older (but not archived) emails, you can either

  1. Set the Exchange account to sync all items in the Exchange account properties dialog. Outlook must be restarted.
  2. Set the Exchange account to sync all items programmatically. You can do that using Extended MAPI (C++ or Delphi only), there is a flag that needs to be set in the MSEMS profile section. Redemption (any language) exposes the RDOExchangeMailboxStore.MonthsToKeepOffline / DaysToKeepOffline properties. Outlook must be restarted.
  3. Open the parent folder in the online mode using the MAPI_NO_CACHE flag when calling IMsgStore::OpenEntry (Extended MAPI, C++ or Delphi only). Redemption lets you pass that flag when you open the folder using RDOSession.GetFolderFromID from any language.


来源:https://stackoverflow.com/questions/39595941/programmatically-accessing-archived-mails-in-an-exchange-folder

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