Fetching Data based on Datatime field in MS CRM 2011 plugin

If you are looking for the code to retrieve data based on Datetime field you can use below code

private EntityCollection RetrieveData(DateTime _Date,IOrganizationService _iService)


 QueryExpression _Query = new QueryExpressio{

    EntityName = “EntityName”, //Replace with entityname

    ColumnSet = new ColumnSet(“AttributeName”), //list of fields

         Criteria =


              FilterOperator = LogicalOperator.And,

              Conditions =


                new ConditionExpression


                 AttributeName=”_issuedate”, //Replace Condition attribute name


                  Values={_Date } //Replace condition value







         EntityCollection _Entities = _iService.RetrieveMultiple(_Query);

Return _Entities;


 Enjoy !!!



Leave a comment

Filed under MS CRM 2011

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