melly620
11-06-2015, 03:11 PM
I receive a lot of meeting requests that clog up my inbox and want to filter them into a folder ("Calendar Archive") so that I can check them just once a day UNLESS the meeting request/update is for today, in which case I'd like to move it to a different folder ("Appointments"). Essentially I want:
1. Check if item is a meeting request. If not, exit.
2. Check if meeting request is for today.
2a. If yes, move to Appointments folder.
2b. If no, move to Calendar Archive folder.
I've written some code so that I can create a rule that runs this as a script on all incoming mail but it doesn't seem to work. Any corrections would be much appreciated!
Sub CheckApptDate(Item As Outlook.MailItem)
If Item.MessageClass <> "IPM.Schedule.Meeting.Request" And Item.MessageClass <> "IPM.Schedule.Meeting.Canceled" Then
Exit Sub
End If
Dim myItem As Outlook.AppointmentItem
Set myItem = Item
Set ArchiveFolder = Application.GetNamespace("MAPI"). _
GetDefaultFolder(olFolderInbox).Parent.Folders("Calendar Archive")
Set MainFolder = Application.GetNamespace("MAPI"). _
GetDefaultFolder(olFolderInbox).Folders("Appointments")
If myItem.Start > Date Then
myItem.Move ArchiveFolder
Else
myItem.Move MainFolder
End If
End Sub
1. Check if item is a meeting request. If not, exit.
2. Check if meeting request is for today.
2a. If yes, move to Appointments folder.
2b. If no, move to Calendar Archive folder.
I've written some code so that I can create a rule that runs this as a script on all incoming mail but it doesn't seem to work. Any corrections would be much appreciated!
Sub CheckApptDate(Item As Outlook.MailItem)
If Item.MessageClass <> "IPM.Schedule.Meeting.Request" And Item.MessageClass <> "IPM.Schedule.Meeting.Canceled" Then
Exit Sub
End If
Dim myItem As Outlook.AppointmentItem
Set myItem = Item
Set ArchiveFolder = Application.GetNamespace("MAPI"). _
GetDefaultFolder(olFolderInbox).Parent.Folders("Calendar Archive")
Set MainFolder = Application.GetNamespace("MAPI"). _
GetDefaultFolder(olFolderInbox).Folders("Appointments")
If myItem.Start > Date Then
myItem.Move ArchiveFolder
Else
myItem.Move MainFolder
End If
End Sub