locked
How to retrieve all columns using RetriveMultiple with QueryExpression RRS feed

  • Question

  • I need to get all the attributes that are available on an entity. For example, if there are 50 attributes in Contact, I need to get all 50 attributes for all the contact records. I am using RetriveMultiple method with QueryExpression. with QueryExpression, you can specify which column you want to return. However, I couldn't find out how to return all columns without specifying all columns explicitly.

    Does anyone have ideas how to do that?

    Thanks in advance!

     

    Monday, September 12, 2011 11:45 PM

Answers

  • Use the constructor with a boolean parameter:

    public ColumnSet (
    	bool allColumns
    )
    
    


     


    --pogo (pat) @ pogo69.wordpress.com
    • Marked as answer by Vicky922 Tuesday, September 13, 2011 1:33 AM
    Tuesday, September 13, 2011 12:20 AM

All replies

  • Use the constructor with a boolean parameter:

    public ColumnSet (
    	bool allColumns
    )
    
    


     


    --pogo (pat) @ pogo69.wordpress.com
    • Marked as answer by Vicky922 Tuesday, September 13, 2011 1:33 AM
    Tuesday, September 13, 2011 12:20 AM
  • Try this this should work too

     

    QueryExpression query = new QueryExpression()
    {
     EntityName = "task",
    ColumnSet = new AllColumns(),
    Criteria =
    {
    Conditions =
    {
    new ConditionExpression()
    {
    AttributeName = "something",
    Operator = ConditionOperator.Equal,
    Values = new object[] {"something"}
    }
    }
    }
    };

     


    Amreek singh Senior CRM Consultant CDC Praxa Sydney,Australia http://mscrmshop.blogspot.com/
    • Edited by Amreek Singh Tuesday, September 13, 2011 1:08 AM
    • Proposed as answer by Amreek Singh Tuesday, September 13, 2011 1:08 AM
    • Unproposed as answer by Amreek Singh Tuesday, September 13, 2011 2:03 AM
    Tuesday, September 13, 2011 1:07 AM
  • Thanks for the reply! It works!
    Tuesday, September 13, 2011 1:33 AM
  • Thanks for the information. However, I got missing namespace reference for AllColumns....
    Tuesday, September 13, 2011 1:34 AM
  • Sorry that was crm 4.0 sample.
    Amreek singh Senior CRM Consultant CDC Praxa Sydney,Australia http://mscrmshop.blogspot.com/
    Tuesday, September 13, 2011 2:02 AM