Get reference to additional Inbox

后端 未结 3 2128
情歌与酒
情歌与酒 2020-11-22 06:42

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

相关标签:
3条回答
  • 2020-11-22 07:13

    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
    
    0 讨论(0)
  • 2020-11-22 07:17
    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
    
    0 讨论(0)
  • 2020-11-22 07:29

    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

    0 讨论(0)
提交回复
热议问题