View Full Version : Incoming email to non default mailbox
dsk96m
11-19-2013, 07:56 AM
I am trying to figure out how to catch an incoming email to a non default mailbox. So I have two mailboxes. My work email mailbox (I am on exchange server) and a shared mailbox. I need to test incoming mail items into the shared mailbox (which i added through advanced settings in my default advanced options). I try application.newmail, but it isnt catching items into the shared mailbox, just the default on. How do I do this? I have been search all over the place.
skatonni
11-19-2013, 04:39 PM
The basic idea is here http://www.outlookcode.com/article.aspx?id=62
Option Explicit
Private WithEvents olInboxItems As Items
Private Sub Application_Startup()
Dim objNS As NameSpace
Set objNS = Application.Session
' instantiate objects declared WithEvents
Set olInboxItems = objNS.GetDefaultFolder(olFolderInbox).Items
Set objNS = Nothing
End Sub
Private Sub olInboxItems_ItemAdd(ByVal Item As Object)
' do something
End Sub
Instead of
Set olInboxItems = objNS.GetDefaultFolder(olFolderInbox).Items
try this more general format
Set olInboxItems = objNS.Folders("name of shared mailbox”).Folders("Inbox").Items
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.