Open Outlook mail Item using EntryID, StoreID, and / or PR_ENTRYID

前端 未结 2 1238
别跟我提以往
别跟我提以往 2021-01-05 05:08

NOTE: I\'m using VBA and Office 2007. (I would use C#, but the project parameters don\'t allow this)

I\'m attempting to find some method in Outlook, or an API, that

2条回答
  •  余生分开走
    2021-01-05 05:36

    Use Namespace.GetItemFromID. Note the second parameter (store id) is optional. You can omit it if the store in question was already touched by Outlook is in the current session. If not, Outlook will raise the "unknown entry id" exception. If the store entry id is specified, Outlook will open it first, and the store provider will have a chance to register its entry ids with the MAPI system.

    set App = CreateObject("Outlook.Application")
    set NS = App.GetNamespace("MAPI")
    NS.Logon
    set Msg = NS.GetItemFromID(EntryID)
    MsgBox Msg.Subject
    

提交回复
热议问题