VSTO Outlook GetTable filter, why is it invalid?
I'm trying to get a table from the contacts folder
GetContactsFolder().GetTable(filter, OlItemType.olContactItem);
but I keep getting exceptions, "Condition is not valid". I've tried several different filter syntaxt. I want to do a LIKE query. The following filter works
[Email1Address] = 'something@domain.com'
but none of these work
[Email1Address] LIKE '%something%'
[Email1Address] LIKE '* something *'
[Email1Address] LIKE '#something#'
[Email1Address] LIKE '?something?'
If I开发者_开发技巧 use outlook to setup view filters, it produces LIKE statements using % but for some reason it doesn't work for me.
Ideas?
What a shame that no one could answer this. The answer is because
- I'm using JET syntaxt and JET doesn't support LIKE
- Need to use DASL syntaxt ""http://schemas.microsoft.com/mapi/id/{00062004-0000-0000-C000-000000000046}/8084001f" LIKE '%something%'" which I tried (getting the SQL from outlook)
Need to use DASL syntaxt BUT, need to prefix it with @SQL=
string filter="@SQL=\"http://schemas.microsoft.com/mapi/id/{00062004-0000-0000-C000-000000000046}/8084001f" LIKE '%something%'\"";
精彩评论