retrieve all accounts RRS feed

  • Question

  • how would i retrieve all accounts using the sdk. 

    would i just do a retireve mulitple and leave the entity id out of filter expression?

    Wednesday, August 26, 2009 1:22 PM


  • You can use the code below to retrieve all acounts.

    QueryExpression query = new QueryExpression();
    query.EntityName = "account";
    query.ColumnSet = new AllColumns();
    RetrieveMultipleRequest request = new RetrieveMultipleRequest();
    request.Query = query;
    RetrieveMultipleResponse response = (RetrieveMultipleResponse)CrmServiceUtility.CrmSdkService.Execute(request);

    Besides the above I would also recommend that you use the PageInfo property of the QueryExpression class. This will ensure that your application does not time out when displaying large number of accounts in a custom web application.


    Hassan Hussain | http://hassanhussain.wordpress.com/
    • Proposed as answer by Hassan Hussain Wednesday, August 26, 2009 1:38 PM
    • Marked as answer by TreyFastLane Wednesday, August 26, 2009 2:19 PM
    Wednesday, August 26, 2009 1:38 PM