Get reference to additional Inbox
I'm using Outlook 2007 - and have my main mailbox: Tait, Mark
I have also added another mailbox to my profile: Procurement, Request
Both appear as top level folders within Outlook:
Mailbox - Tait, Mark> -Conversation History
-Deleted Items
-Drafts
-Inbox
-Junk E-MailMailbox - Procurement, Request
--Conversation History
--Deleted Items
--Drafts
--Inbox
--Junk E-Mail
I can get a reference to my default Inbox (Tait, Mark) using:Set Inbox = ns.GetDefaultFolder(olFolderInbox)
How do I get a reference to the Inbox in the "Procurement, Request" mailbox?
Solution 1:
Something like this should do the trick
Dim objNS As Outlook.NameSpace
Dim objFolder As Outlook.MAPIFolder
Set objNS = GetNamespace("MAPI")
Set objFolder = objNS.Folders("Procurement, Request")
Set objFolder = objFolder.Folders("Inbox")
This link has some useful code for handling different Inboxes - it may be of interest
Solution 2:
Dim olNS As NameSpace
Dim InputFolder As Outlook.MAPIFolder
Set olNS = Outlook.Application.GetNamespace("MAPI")
' Get reference to folder in users Mailbox for Input
Set InputFolder = olNS.Folders("Procurement, Request").Folders("Inbox")
' all the emails in the shared inbox are represented by:
InputFolder.Items