1

Is it possible to make a NOT LIKE filter on the ExecSQL subject of a MAPITable?

I'm doing this filter:

MAPITable mt = session.Stores.MAPITable;
mt.Item = inbox.Items;
var records = mt.ExecSQL($"select Subject, EntryID from Inbox Where Subject not like '%[DocSite %'");

But I'm having this exception:

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in ConsoleApplication1.exe

Additional information: Assertion failed: Number of fields == 1

If I remove the NOT constrain, the like filter it is apply and works. The problem is the NOT constrain.

Anderson Rissardi
  • 2,377
  • 1
  • 16
  • 21

1 Answers1

1

Have you tried to put parenthesis around like the following and move the not operator out? $"select Subject, EntryID from Inbox Where not (Subject like '%[DocSite %') "

Dmitry Streblechenko
  • 62,942
  • 4
  • 53
  • 78