How to reference server inbox instead of offline inbox?

668 views Asked by At

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.

2

There are 2 answers

3
ko_00 On

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/

0
Dmitry Streblechenko On

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 (I am its author - 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