Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Select all column in QueryExpression CRM 2011

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.

like image 649
Romeo Avatar asked Apr 22 '14 06:04

Romeo


2 Answers

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

query.ColumnSet = new ColumnSet(true);

then it will select all columns

like image 119
Kevin Ross Avatar answered Nov 07 '22 22:11

Kevin Ross


Use this it works in CRM 2015

query.ColumnSet.AllColumns = true;

and do not set anything in

query.ColumnSet
like image 30
Opt Prutal Avatar answered Nov 07 '22 21:11

Opt Prutal