rodsynergy
New Member
I am trying to monitor an Outlook shared mailbox. I have a code stage that works on my mailbox but fails on all shared mailboxes. There has been quite a few posts so far on this forum but I can't see any successful responses yet. Would appreciate it if you would reply if you have solved this puzzle!
My code stage is as follows:
Dim OutlookMailBox As String = [MailBoxName]
Dim outlook as Object
Dim ns As Object
Dim Inbox As Object
Dim i As Object
outlook = CreateObject("Outlook.Application")
ns = outlook.GetNamespace("MAPI")
Inbox = ns.Folders(OutlookMailBox)
[MailBoxExists] = False
For i = 1 To Inbox.Folders.Count
FolderNames = FolderNames + Inbox.Folders.Item(i).Name
If Inbox.Folders.Item(i).Name = InboxName Then
[MailBoxExists] = True
End If
Next i
[numberFolders] = i
Catch ex As System.Exception
ErrMessage = ex.Message
End Try
This passes back a true for the exists flag, and a list of all the sub folders in my mailbox when run for my account. For the shared mailbox it passed a false for the exists flag and the following error message: "The attempted operation failed. An object could not be found."
My code stage is as follows:
Dim OutlookMailBox As String = [MailBoxName]
Dim outlook as Object
Dim ns As Object
Dim Inbox As Object
Dim i As Object
outlook = CreateObject("Outlook.Application")
ns = outlook.GetNamespace("MAPI")
Inbox = ns.Folders(OutlookMailBox)
[MailBoxExists] = False
For i = 1 To Inbox.Folders.Count
FolderNames = FolderNames + Inbox.Folders.Item(i).Name
If Inbox.Folders.Item(i).Name = InboxName Then
[MailBoxExists] = True
End If
Next i
[numberFolders] = i
Catch ex As System.Exception
ErrMessage = ex.Message
End Try
This passes back a true for the exists flag, and a list of all the sub folders in my mailbox when run for my account. For the shared mailbox it passed a false for the exists flag and the following error message: "The attempted operation failed. An object could not be found."