M
Mark Gonyea
Hi,
I am trying to find a way to have a msgbox pop up whenever a new post
arrives in a specific public folder.
I have not had much luck, mostly I am using the below code. I have been
getting Type Mismatch errors. I think this is because there are some
MailItems in the list. I cannot figure out how to differntiate between them
programmatically.
Also, I tried putting this code in "This Outlook Session",
Application.NewItem but this seems to be only for new mail items in Inbox. I
cant seem to find the event for new post item in a public folder. There must
be one becuase the folder name turns bold whenever a new unread post
appears.
Any help is appreciated, to either help fix this code, or to point me to a
better way to do this.
Best Regards
Mark
Private Sub CheckPublicFolder()
Dim objOutlook As Outlook.Application
Dim Folder As Outlook.MAPIFolder
Dim nms As Outlook.NameSpace
Dim items As Outlook.items
Dim m_item As MailItem
Dim Post_item As PostItem
Dim i 'count of items
Set objOutlook = CreateObject("Outlook.application")
Set nms = objOutlook.GetNamespace("MAPI")
Set Folder =
nms.GetFolderFromID("000000001A447390AA6611CD9BC800AA002FC45A0300FCA5E51DD65
4694DB32C3FDB1F2A598C00000012402E0000")
Set items = Folder.items
For Each Post_item In items
If Post_item.UnRead = True Then
MsgBox "New message arrived in My Public Folder"
End If
Next
End Sub
I am trying to find a way to have a msgbox pop up whenever a new post
arrives in a specific public folder.
I have not had much luck, mostly I am using the below code. I have been
getting Type Mismatch errors. I think this is because there are some
MailItems in the list. I cannot figure out how to differntiate between them
programmatically.
Also, I tried putting this code in "This Outlook Session",
Application.NewItem but this seems to be only for new mail items in Inbox. I
cant seem to find the event for new post item in a public folder. There must
be one becuase the folder name turns bold whenever a new unread post
appears.
Any help is appreciated, to either help fix this code, or to point me to a
better way to do this.
Best Regards
Mark
Private Sub CheckPublicFolder()
Dim objOutlook As Outlook.Application
Dim Folder As Outlook.MAPIFolder
Dim nms As Outlook.NameSpace
Dim items As Outlook.items
Dim m_item As MailItem
Dim Post_item As PostItem
Dim i 'count of items
Set objOutlook = CreateObject("Outlook.application")
Set nms = objOutlook.GetNamespace("MAPI")
Set Folder =
nms.GetFolderFromID("000000001A447390AA6611CD9BC800AA002FC45A0300FCA5E51DD65
4694DB32C3FDB1F2A598C00000012402E0000")
Set items = Folder.items
For Each Post_item In items
If Post_item.UnRead = True Then
MsgBox "New message arrived in My Public Folder"
End If
Next
End Sub