Outlook VBA Move / Delete based on item type (Help)
I'm looking for outlook help in writing some vba to look in my deleted items and find the different types of items in there and then differentiate between items I want and items I don't want. With the items I want I would move to a folder called "Trash" and with the items I don't want I would have them deleted permanently.
With that said I suppose my first step is to figure out how to determine all of the items within my deleted folder and decide which ones I want and don't want.
when I run this code
Code:
Public Sub GetTypeNamesDeleted()
Dim myOlItems As Outlook.Items
Set myOlItems = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderDeletedItems).Items
Dim msg As Object
Dim s As String
Dim n As Integer
n = FreeFile()
Open "C:\Users\U00JBK7\test.txt" For Output As #n
For Each msg In myOlItems
Debug.Print TypeName(msg)
s = TypeName(msg)
Print #n, s
Next msg
Close #n
End Sub
it tells me that I have the following types in my deleted folder:
AppointmentItem
MailItem
MeetingItem
ReportItem
PostItem
SharingItem
DistListItem
TaskItem
ContactItem
Now that I know that how do I know by looking which one's I would want and which ones I don't want. Is there an icon / type matcher somewhere? When I scroll through my deleted items I have no idea what's considered an "AppointmentItem" or a "MeetingItem".