简体   繁体   中英

How to reference server inbox instead of offline inbox?

I want to iterate through my entire Outlook inbox, including messages stored on the MS Exchange Server. However, when I reference my Outlook inbox via:

NameSpace.GetDefaultFolder(olFolderInbox)

It only returns the items in my offline inbox. Does anybody know how to return the entire server archive?

Thanks for your help.

You need to add something to your ThisOutlookSession (vba) before you are able to perform what you would like to do.

Please refer to the following website. There is a lot explained about connecting to shared folders (exchange) and calendars.

https://www.slipstick.com/developer/working-vba-nondefault-outlook-folders/

You need to open the folder in the online mode. You can either

1) Turn cached mode off (not ideal from the performance point of course)

2) Reopen the folder in the online mode using Extended MAPI (C++ or Delphi only) using IMAPISession::OpenEntry and the MAPI_NO_CACHE ( 0x0200 ) flag.

3) Reopen the folder using Redemption (any language) - it exposes (2) above:

MAPI_NO_CACHE = &H200 
MAPI_BEST_ACCESS &H10
set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set vFolder = Session.GetFolderFromID(YourOOMFolder.EntryID, , MAPI_NO_CACHE + MAPI_BEST_ACCESS)
MsgBox vFolder.Items.Count

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM