Sub lastfewdaysusingdslquery()
Dim olApp, olAccts, olInspect, ns As Object
Dim myStoreID, myEntryID As String
Set olApp = CreateObject("Outlook.Application")
Dim olFolder As outlook.MAPIFolder
Set ns = outlook.GetNamespace("MAPI")
lastWeek = Date - 7
'strFind = "[ReceivedTime] >= '" & lastWeek & " 12:00 AM' AND [ReceivedTime] <= '" & Date & " 11:59 PM'"
strFind = "@SQL=" & Chr(34) _
& "urn:schemas:httpmail:subject" & Chr(34) _
& " = 'hello'"
MsgBox (strFind)
Set olFolder = ns.Folders("allsourav@hotmail.com").Folders("Inbox")
Set filteritems = olFolder.Items.Restrict(strFind)
MsgBox (filteritems.count)
For Each citem In filteritems
Next citem
End Sub
Showing posts with label Finding emails using DASL query in outlook using vba. Show all posts
Showing posts with label Finding emails using DASL query in outlook using vba. Show all posts
Tuesday, November 2, 2021
Filtering emails using DASL query in outlook using vba
Subscribe to:
Posts (Atom)