I'd like some help figuring out why my restrict filter is not working. Here is a sample of my code that works:
Code: Select all
outlook := ComObjActive("Outlook.Application")
outlooknamespace := outlook.GetNameSpace("MAPI")
inboxfolder := outlooknamespace.GetDefaultFolder(6)
currentmessage := inboxfolder.Items.Restrict("[Unread] = True").GetLast()
clipboard := currentmessage.senderemailaddress
msgbox % clipboard
Code: Select all
Filter := """[Unread] = True"""
outlook := ComObjActive("Outlook.Application")
outlooknamespace := outlook.GetNameSpace("MAPI")
inboxfolder := outlooknamespace.GetDefaultFolder(6)
currentmessage := inboxfolder.Items.Restrict(Filter).GetLast()
clipboard := currentmessage.senderemailaddress
msgbox % clipboard
it fails with error message:
Error: 0x80041200
Source: Microsoft Outlook
Description: Condition is not valid
etc. etc.
----> currentmessage := inboxfolder.items.Restrict(Filter).GetLast()
I am planning a more specific and complex filter with variables in it, which would make it ideal to set aside into its own "Filter" variable, but i can't seem to make it work.
I am running Win10 x64 v1809 and AHK 1.1.30.01. Also Outlook 2016.
Any suggestions and help would be greatly appreciated.