How to refrence the inbox of an additional mailbox in Outlook?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • bill

    How to refrence the inbox of an additional mailbox in Outlook?

    I have this code to get to the default Outlook inbox but I would like to get
    to the inbox of an additional added mailbox. Can this be done? Here is the
    code I'm using below:
    Dim objSession As MAPI.Session

    Dim objInbox As MAPI.Folder

    Dim objMessages As MAPI.Messages

    Dim objMessage As MAPI.Message

    Dim objEmbeddedMess age As MAPI.Message

    Dim objNewMail As MAPI.Message

    If cboFileType.Sel ectedIndex <-1 Then

    ListBox1.Items. Clear()

    'create session and logon

    objSession = CreateObject("M API.Session")

    'Use this for non exchange outlook - objSession.Logo n("Outlook")

    objSession.Logo n("Default Outlook Profile") 'works on Halliburton COE

    ' objSession.Logo n()

    'reference the messages in the inbox

    objInbox = objSession.Inbo x

    objMessages = objInbox.Messag es

    --
    Bill Bray


  • aaron.kempf@gmail.com

    #2
    Re: How to refrence the inbox of an additional mailbox in Outlook?

    at www.freevbcode.com they have some more examples..

    I just know that in one of these methods you can rewrite
    objInbox = objSession.Inbo x

    for each objInbox in objSession.Fold ers
    Msgbox objInbox.Name
    End if

    It should be something like that; just iterate through the folders
    until you see the folder name you want.. I am pretty sure that should
    help, but YMMV

    -Aaron



    On Mar 8, 9:52 pm, "bill" <b...@bottlegar den.comwrote:
    I have this code to get to the default Outlook inbox but I would like to get
    to the inbox of an additional added mailbox.  Can this be done?  Here is the
    code I'm using below:
    Dim objSession As MAPI.Session
    >
    Dim objInbox As MAPI.Folder
    >
    Dim objMessages As MAPI.Messages
    >
    Dim objMessage As MAPI.Message
    >
    Dim objEmbeddedMess age As MAPI.Message
    >
    Dim objNewMail As MAPI.Message
    >
    If cboFileType.Sel ectedIndex <-1 Then
    >
    ListBox1.Items. Clear()
    >
    'create session and logon
    >
    objSession = CreateObject("M API.Session")
    >
    'Use this for non exchange outlook - objSession.Logo n("Outlook")
    >
    objSession.Logo n("Default Outlook Profile") 'works on Halliburton COE
    >
    ' objSession.Logo n()
    >
    'reference the messages in the inbox
    >
    objInbox = objSession.Inbo x
    >
    objMessages = objInbox.Messag es
    >
    --
    Bill Bray

    Comment

    • bill

      #3
      Re: How to refrence the inbox of an additional mailbox in Outlook?

      Thank you I will give that a shot!

      <aaron.kempf@gm ail.comwrote in message
      news:f3698006-4798-494f-9ab8-1f67289e1cda@u1 0g2000prn.googl egroups.com...
      at www.freevbcode.com they have some more examples..

      I just know that in one of these methods you can rewrite
      objInbox = objSession.Inbo x

      for each objInbox in objSession.Fold ers
      Msgbox objInbox.Name
      End if

      It should be something like that; just iterate through the folders
      until you see the folder name you want.. I am pretty sure that should
      help, but YMMV

      -Aaron



      On Mar 8, 9:52 pm, "bill" <b...@bottlegar den.comwrote:
      I have this code to get to the default Outlook inbox but I would like to
      get
      to the inbox of an additional added mailbox. Can this be done? Here is the
      code I'm using below:
      Dim objSession As MAPI.Session
      >
      Dim objInbox As MAPI.Folder
      >
      Dim objMessages As MAPI.Messages
      >
      Dim objMessage As MAPI.Message
      >
      Dim objEmbeddedMess age As MAPI.Message
      >
      Dim objNewMail As MAPI.Message
      >
      If cboFileType.Sel ectedIndex <-1 Then
      >
      ListBox1.Items. Clear()
      >
      'create session and logon
      >
      objSession = CreateObject("M API.Session")
      >
      'Use this for non exchange outlook - objSession.Logo n("Outlook")
      >
      objSession.Logo n("Default Outlook Profile") 'works on Halliburton COE
      >
      ' objSession.Logo n()
      >
      'reference the messages in the inbox
      >
      objInbox = objSession.Inbo x
      >
      objMessages = objInbox.Messag es
      >
      --
      Bill Bray

      Comment

      Working...