Select all column in QueryExpression CRM 2011

Romeo picture Romeo · Apr 22, 2014 · Viewed 14.3k times · Source

I have this QueryExpression in my code.

 QueryExpression query = new QueryExpression() { };

 query.EntityName = "country";
 query.ColumnSet = new ColumnSet("name", "2digitiso", "3digitiso");

 EntityCollection retrieved = _service.RetrieveMultiple(query);

My question is, Is there a way to select all the columns in the "country" without providing any ColumnSet? pretty much I want something like the SELECT * from the SQL Query.

Answer

Kevin Ross picture Kevin Ross · Apr 22, 2014

Yes, if you change your third line to look like this

query.ColumnSet = new ColumnSet(true);

then it will select all columns