Not much seems to be known about the advanced search syntax used in Outlook. But this blog article has a couple of useful links.
And here is the Microsoft Dev page on the Advanced Search method.
Outlook Spy might be a good tool to figure this out.
While working with Outlook email using Windows Powershell, I noticed that Outlook did not close. This is because Windows will not close the Outlook process until all programs are done with it. This blog post has a nice discussion about it as well as the method for forcing the COM object to close.