Use the ColumnSet class

 

Updated: November 29, 2016

Applies To: Dynamics 365 (online), Dynamics 365 (on-premises), Dynamics CRM 2016, Dynamics CRM Online

In Microsoft Dynamics 365 (online & on-premises), you can use the ColumnSet class to specify what attributes to return from a query expression. The query returns only non-null values.

You can also use the ColumnSet class to reduce the size of a query result by defining only those attributes to be returned. To improve server performance, it is recommended that you don’t execute a query that returns all columns.


The following code example shows how to use the ColumnSet class to specify what attributes to return from a query expression.

QueryExpression contactquery = new QueryExpression 
{
   EntityName="contact",
   ColumnSet = new ColumnSet("firstname", "lastname", "contactid") 
};

Microsoft Dynamics 365

© 2016 Microsoft. All rights reserved. Copyright

Community Additions

ADD
Show: