ContactCollection.Restrict

  • Thread starter Thread starter mmobile
  • Start date Start date
M

mmobile

I need help in using the ContactCollection.Restrict with the "Categories"
property.

I tried:
contactCollection.Restrict("[Categories] = 'TestCat'");

but I get a System.ArgumentException with the message of: The query string
is incorrectly formatted.\r\nParameter name: [Categories] = 'TestCat'

Does anyone know the correct format string to use for the Restrict method
when looking for contacts which are part of a particular category?

Thanks in advance for the help.
 
Yes you must use double quotes around the category name, which in C# must be
escaped like:-

contactCollection.Restrict("[Categories] = \"TestCat\"");

Peter
 
Back
Top