Select all column in QueryExpression CRM 2011
Asked Answered
C

3

8

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.

Corporeity answered 22/4, 2014 at 6:21 Comment(0)
V
22

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

query.ColumnSet = new ColumnSet(true);

then it will select all columns

Verdaverdant answered 22/4, 2014 at 7:3 Comment(1)
You get the same effect if you don't specify any Column SetZoba
F
6

Use this it works in CRM 2015

query.ColumnSet.AllColumns = true;

and do not set anything in

query.ColumnSet
Function answered 24/3, 2016 at 12:23 Comment(0)
A
2

yes that's right if you want retrieve all all columns means we have to specify the property "true" otherwise we have to customize the column set like ColumnSet ss=new ColumnSet("name","address","gender");

Attainture answered 23/4, 2014 at 4:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.