Shared Mailbox Alert

Status
Not open for further replies.

shodan01

Member
Outlook version
Outlook 2010 64 bit
Email Account
Exchange Server
Process items in a shared mailbox

I want to setup a desktop or a sound alert to the message that comes into my shared folder.
I tried this macro, but I've got an error message. The first line became yellow if i tried to run it.
And the GetFolderPath wrong. I used my Mailbox name in this form - > ("**********\Inbox")
Whats the problem???

Private WithEvents olInboxItems As Items

Private Sub Application_Startup()
Dim objNS As NameSpace
Set objNS = Application.Session

' Get function from Working with VBA and non-default Outlook Folders
Set olInboxItems = GetFolderPath("Mailbox name in folder list\Inbox").Items
Set objNS = Nothing
End Sub

Private Sub olInboxItems_ItemAdd(ByVal Item As Object)
On Error Resume Next

Item.Categories = "My Category"
Item.Save
Set myForward = Item.Forward
'this puts the name in the To field
myForward.Recipients.Add "me@domain.com"
myForward.Display ' use .Send to send it automatically


End Sub
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
is the shared inbox open in your profile as part of the mailbox or just as a folder? Can see all of the folders in the shared mailbox in the Folder list or did you open the folder using Open > other users folder? How you opened it controls the code you need to watch it.
 

shodan01

Member
Outlook version
Outlook 2010 64 bit
Email Account
Exchange Server
It is a part of the mailbox, not just a folder. I will upload some screenshot tomorrow. Thanks!
 

oliv-

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Hi,
You can test it

If you want an alert it's better using an Userform (vbmodeless) than Msgbox

Code:
Private WithEvents olInboxItems As Items

Private Sub Application_Startup()
Dim objNS As NameSpace
Set objNS = Application.Session

' Get function from Working with VBA and non-default Outlook Folders
Set olInboxItems = objNS.folders("Mailbox name in folder list").folders("Inbox").Items
Set objNS = Nothing
End Sub

Private Sub olInboxItems_ItemAdd(ByVal Item As Object)
On Error Resume Next

Msgbox Item

End Sub
 

shodan01

Member
Outlook version
Outlook 2010 64 bit
Email Account
Exchange Server
Thank you! I will try that, anyway this is how my mailbox looklike...


I want to setup, when i got a mail for the second mailbox inbox, outlok show me an alert desktop notif.
 

shodan01

Member
Outlook version
Outlook 2010 64 bit
Email Account
Exchange Server
But i unable to make sound. The msgbox trigger the default "beep" sound in windows if i know well, but i cant hear anything. In the control panel/sound /sounds activated.
Can i change msgbox to critical? maybe it has sounds. How can i do that in this example?
 
Status
Not open for further replies.
Top