0

I want to flag and label items for action.

If the item is in any Inbox or regular mail folder, flag the item, label the item as "#Action" and move it to an "#Action" folder.

If the item is in the Sent Folder, label flag the item and move it to an "#Inquiry" folder.

How do I check what folder an item is in before taking action?

I figure I can first declare the sent folder like this:

Dim SentItems As Folder  
Set SentItems = Outlook.Application.GetNamespace("MAPI")>GetDefaultFolder(olFolderSentMail)

How do I check whether an item is in SentItems?

Something like

Dim obj As Object Dim msg As Outlook.MailItem
For Each obj In ActiveExplorer.Selection

    If obj In SentItems Then
        do the sent item stuff
    Else
        do the all other folder stuff
    End If
Community
  • 1
  • 1

2 Answers2

1

You could use

obj.Parent.Name

or maybe

obj.Parent.FullFolderPath

Tim Williams
  • 154,628
  • 8
  • 97
  • 125
0
If obj.Parent.Name = "Sent Items" Then 
stuff 
Else
other stuff 
End If