开发者

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

  1. I'm using JET syntaxt and JET doesn't support LIKE
  2. 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)
  3. 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%'\"";

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜