By Mark

2012-01-31 08:41:02 8 Comments

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
-Junk E-Mail

Mailbox - Procurement, Request
--Conversation History
--Deleted Items
--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?


@Dmitry Streblechenko 2015-09-04 04:10:56

Use Namespace.GetSharedDefaultFolder. It will work even if the mailbox is not opened in the current profile. You still need to have the right to open the mailbox and access the folder in question of course:

Set vNamespace = Application.GetNamespace("MAPI")
set vRecipient = vNamespace.CreateRecipient("Procurement, Request")
if vRecipient.Resolve Then
  set vFolder = vNamespace.GetSharedDefaultFolder(vRecipient, olFolderInbox)
End If

If you need to open the other user's mailbox (with all off its folders), you can use Redemption and its RDOSession.GetSharedMailbox method:

 set Session = CreateObject("Redemption.RDOSession")
 Session.MAPIOBJECT = Application.Session.MAPIOBJECT
 set Store = Session.GetSharedMailbox("Procurement, Request")
 set vFolder = Store.GetDefaultFolder(olFolderInbox)
 MsgBox "The address of the mailbox owner: " & Store.Owner.Address

@Bruno 2016-02-26 16:44:21

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:

@JAL 2016-02-26 17:23:25

Please elaborate on how this code answers the question.

@brettdj 2012-01-31 09:25:47

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

@Mark 2012-01-31 09:51:23

Thank you very much!!! :)

@brettdj 2012-01-31 09:59:41

@MarkTait glad to have helped :)

@Dmitry Streblechenko 2017-10-12 16:09:52

This will work only if the store was already added to the curent profile.

@user3177026 2018-06-05 09:18:00

@brettdj please how can I automate the Set objFolder = objNS.Folders("Procurement, Request") and Set objFolder = objFolder.Folders("Inbox") into a function like Public Sub AppResponseManage(Item As Outlook.MailItem) that receive a Mailitem as a parameter (in other words how can I extract the mailbox name and the inbox folder name from a mail item?) Thanks a lot

Related Questions

Sponsored Content

5 Answered Questions

[SOLVED] Python Outlook: Read Inbox of additional mailbox

  • 2014-04-08 09:08:11
  • heycooldude
  • 3964 View
  • 2 Score
  • 5 Answer
  • Tags:   python outlook inbox

1 Answered Questions

Outlook VBA Access Folders in Shared Mailbox

  • 2018-06-11 16:39:13
  • chilluk
  • 239 View
  • 0 Score
  • 1 Answer
  • Tags:   vba outlook

1 Answered Questions

how to extract sent items from outlook shared mailbox in excel vba

  • 2018-05-28 11:18:23
  • Jz Worx
  • 403 View
  • 1 Score
  • 1 Answer
  • Tags:   excel vba outlook

2 Answered Questions

[SOLVED] Set reference to PST folders

  • 2018-02-02 08:31:27
  • Gofrsz
  • 611 View
  • 2 Score
  • 2 Answer
  • Tags:   vba outlook-vba

3 Answered Questions

1 Answered Questions

[SOLVED] How to get Inbox of a delegate mailbox when using 2007 PIA

1 Answered Questions

[SOLVED] Issue with Outlook Event for New Mail

1 Answered Questions

[SOLVED] VBA Moving MailItem after Subject Line Change

  • 2014-04-16 12:24:19
  • Lynchie
  • 138 View
  • -1 Score
  • 1 Answer
  • Tags:   vba outlook

1 Answered Questions

[SOLVED] New Outlook MailItem saving in Inbox rather than Drafts

  • 2013-03-12 18:32:03
  • EricM
  • 667 View
  • 0 Score
  • 1 Answer
  • Tags:   perl outlook ole

1 Answered Questions

VBA code to Read Mails from - Other User's Inbox (Outlook Inbox)

Sponsored Content