Search code examples
gmail-imapimapx

IMapX Gmail SEARCH operation throws exception "Bad or not correct search query"


I have used the ImapX library to SEARCH Gmail using queries like :

ImapX.MessageCollection msg= c.Folders["INBOX"].Search("SUBJECT <abc>", false); 

I get the error above when I try and retrieve a message using

MessageCollection msg= client.Folders["INBOX"].Search("UID <abc>", false);

where i have previously established the UID using the MessageUID property which IMapx exposes on an specific message, I get the same error when trying to use the MessageId property.


Solution

  • ImapX.MessageCollection msg= c.Folders["INBOX"].Search("SUBJECT abc", false);