I am trying to find Outlook Calendar items that include text strings. I've come across two different issues, and wondering if someone can help shed some light on what might be going on.
For simplicity sake, I have provided the following snippets to try to convey my issues without cluttering up the post with too much code.
I am using the following to open the correct Outlook folder and get the Calendar Items:
olFolderCalendar = 9
objOutlook = ObjectOpen("Outlook.application")
objNameSpace = objOutlook.GetNameSpace("MAPI")
objFolder = objNameSpace.GetDefaultFolder(olFolderCalendar)
objCalendarItems = objFolder.Items
I establish a loop and perform the following search for each matching Calendar Item:
TextString="Test"
SearchCriteria = StrCat("[Subject]=","""",TextString,"""")
ItemFound=objCalendarItems.Find(SearchCriteria)
Message("Found Event",ItemFound)
I then close out of Outlook:
ObjectClose(objCalendarItems)
ObjectClose(objFolder)
ObjectClose(objNameSpace)
ObjectClose(objOutlook)
The above search returns items that contain only the word "Test" in the Subject field in an Outlook Calendar Item. If the Subject contains "Test Item", the search above does not return anything. Same thing happens if I search the Billing Information field. I'm wondering if the equal "=" sign that I use in the SearchCriteria variable above might only return an exact match. If that's the case, does anyone know what operator I might use instead of "=" to find a Subject that CONTAINS the word "Test"?
Here's the second issue I'm finding. If I use the same method to search in the Body field of Calendar Items, like this:
TextString="Test"
SearchCriteria = StrCat("[Body]=","""",TextString,"""")
ItemFound=objCalendarItems.Find(SearchCriteria)
Message("Found Event",ItemFound)
nothing is ever found, even if the only word in the Body field in the Outlook Calendar Item is "Test". Is the Body field in Outlook Calendar Items of a particular format that prevents searching altogether? If not, what structure do I need to use in order to find all Calendar Items that include the word "test"?
Thank you.