Michael Philip's Blog

Writing about MS Tech with strong focus on Azure & CRM

How To : Obtain Reocrds Count Without Retrieving Rows of Data

Leave a comment

Introduction: suppose you want to get records count of the entity type “Account” and you don’t want to rows of data.


string fetchQuery = @”<fetch distinct=’false’ mapping=’logical’ aggregate=’true’>
<entity name=’entity name’>
<attribute name=’attribute name’ aggregate=’count’ alias=’aliasName’/>

EntityCollection value = _serviceProxy.Execute(new FetchExpression(fetchQuery));

              Returned result will be something as follow:

<resultset morerecords=”0″‘>

Note: you can check how to create Service Proxy at the following link


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s