Filter unread emails in a search folder vba help

Status
Not open for further replies.

Yousuf@WV

New Member
Outlook version
Outlook 2016 32 bit
Email Account
Exchange Server
Hi I need help with filter all the unread emails in a search folder that is created using the VBA code below. Basically, I need to add the logic to filter out emails that are sent by internal people and forwarded messages. Please advise how do I accomplish this task. I am bit new to this so need some help. I will appreciate it. Thanks!!

Sub CreateSearchFolder_AllNotRepliedEmails()
Dim strScope As String
Dim strRepliedProperty As String
Dim strFilter As String
Dim objSearch As Outlook.Search

'Specify the folders to be searched
'Here we use Inbox folder for an example
strScope = "'" & Application.Session.GetDefaultFolder(olFolderInbox).FolderPath & "'"

'Search filter
strRepliedProperty = "http://schemas.microsoft.com/mapi/proptag/0x10810003"
strFilter = Chr(34) & strRepliedProperty & Chr(34) & " <> 102" & "AND" & Chr(34) & strRepliedProperty & Chr(34) & " <> 103"
Set objSearch = Outlook.Application.AdvancedSearch(Scope:=strScope, Filter:=strFilter, SearchSubFolders:=True, Tag:="SearchFolder")

'Save the search folder
objSearch.Save ("Not Replied Emails")
MsgBox "Search folder is created successfully!", vbInformation + vbOKOnly, "Search Folder"
End Sub
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
R unable to filter tasks when start date is on or before today Using Outlook 3
O Filter-Query Builder-Description - what field name to use? Using Outlook 4
W Macro to Filter Based on Latest Email Outlook VBA and Custom Forms 6
P Prevent Outlook 2016 from using DASL filter Using Outlook 4
Jennifer Murphy Spam filter not working Using Outlook 13
M How create a Rule to filter sender's email with more that one @ sign Using Outlook 1
M Sorting by Day in Date Column Advanced Filter BCM (Business Contact Manager) 1
Z Task Filter Not Working When I add too many criteria Using Outlook 0
M Filter Conversations - Filter Out Single Emails Outlook VBA and Custom Forms 3
B Looking to filter (or just find/search) for only messages that the sender has sent more than 1 messa Using Outlook 2
B Wanting to run a script that will filter any body that has a russian link in it. Outlook VBA and Custom Forms 5
C Filter/Search emails sent to internal Exchange address only Using Outlook 2
e_a_g_l_e_p_i Is there a good third party SPAM filter that intergrates with Outlook 2010 Using Outlook 7
P How to filter primary contacts in business contact manager BCM (Business Contact Manager) 0
O Outlook Web Access - how to disable spam filter Using Outlook 6
G How to filter by the format of an email address Using Outlook 6
S Mail filter recieved before the last 2 working days Using Outlook 1
Liza Creating a rule in outlook to filter messages Using Outlook 0
F Adding textbox filter to listbox? Outlook VBA and Custom Forms 2
Diane Poremsky Filter and Save Contacts to a CSV File Using Outlook 0
Diane Poremsky Filter and Save Contacts to a CSV File Using Outlook 0
Fozzie Bear HomeTab Email filter "Greyed Out" in Outlook 2013 Exchange Server Administration 3
W Filter condition "contains"/"doesn't contain" doesn't always work Using Outlook 10
B Conditional Formatting:How to use >1 value in a filter Using Outlook 7
J Outlook VBA for Email Filter Outlook VBA and Custom Forms 2
Emerogork How do I set up an "Incoming mail filter" Using Outlook 12
M Filter today's mail Using Outlook 2
M trying to disable junk email filter. completely. Using Outlook 4
J Task Filter for Status OR One Month Using Outlook 4
R Filter Views by Category Using Outlook 2
D Junk Mail filter Using Outlook 1
S Filter by accounts but communicate to all linked contacts BCM (Business Contact Manager) 1
D What is this SQL filter that is applied to my Inbox? Using Outlook 6
J Outlook Contacts: How to filter contact phone numbers from a cti request Using Outlook 1
H Two accounts, Junk email filter only works on one account, office 2010, pop3 Using Outlook 5
D How Would I Write This Filter? Using Outlook 3
N Filter end date works differently in OL'07/OL'10 vs OL'03? Hello?! Using Outlook 12
williamlambton Filter which removes Display Names from incoming emails. Using Outlook 2
J How to filter by address fragment (e.g. "@domain.com") with advanced find? Using Outlook 2
L Need a good email filter Using Outlook 2
P BCM Review & Filter BCM (Business Contact Manager) 1
M DASL Filter function? Outlook VBA and Custom Forms 3
M DASL Filter function? Outlook VBA and Custom Forms 3
M Today(S) function in DASL Filter Outlook VBA and Custom Forms 1
M Today(S) function in DASL Filter Outlook VBA and Custom Forms 1
M Create search folder filter that converts UTC time to local? Outlook VBA and Custom Forms 9
E DASL Filter doesn't work when defined programatically Outlook VBA and Custom Forms 1
H Outlook 2007 SQL syntax to filter views of tasks and todo items Outlook VBA and Custom Forms 1
K Can I filter by fields 'containing' specific words? BCM (Business Contact Manager) 1
P Custom rule to filter on sender name Outlook VBA and Custom Forms 5

Similar threads

Back
Top