locked
I want to retrieve attribute names of an entity RRS feed

  • Question

  • hello everyone.
     
    I want to retrieve attribute names of an entity such as "account".
    I try the following code but the "Attributes" property just holds null.
      
    RetrieveEntityRequest request = new RetrieveEntityRequest();
    request.LogicalName = "account";
    RetrieveEntityResponse response = (RetrieveEntityResponse)_service.Execute(request);
    var AttributesSet = response.EntityMetadata.Attributes
     
    No exception occurs.
    What is wrong with this?
      
    Dora

    Taichi,Sato

    • Edited by dora_san Thursday, September 15, 2011 3:26 AM
    Thursday, September 15, 2011 3:25 AM

Answers

  • I think you need to specify the filter

     

    RetrieveEntityRequest request = new RetrieveEntityRequest();
    request.EntityFilters = EntityFilters.Attributes;
    request.LogicalName = "account";
    RetrieveEntityResponse response = (RetrieveEntityResponse)_service.Execute(request);
    var AttributesSet = response.EntityMetadata.Attributes
    I hope this helps.


    Amreek singh Senior CRM Consultant CDC Praxa Sydney,Australia http://mscrmshop.blogspot.com/
    • Proposed as answer by Amreek Singh Thursday, September 15, 2011 5:39 AM
    • Marked as answer by dora_san Thursday, September 15, 2011 5:44 AM
    Thursday, September 15, 2011 5:38 AM

All replies

  • I think you need to specify the filter

     

    RetrieveEntityRequest request = new RetrieveEntityRequest();
    request.EntityFilters = EntityFilters.Attributes;
    request.LogicalName = "account";
    RetrieveEntityResponse response = (RetrieveEntityResponse)_service.Execute(request);
    var AttributesSet = response.EntityMetadata.Attributes
    I hope this helps.


    Amreek singh Senior CRM Consultant CDC Praxa Sydney,Australia http://mscrmshop.blogspot.com/
    • Proposed as answer by Amreek Singh Thursday, September 15, 2011 5:39 AM
    • Marked as answer by dora_san Thursday, September 15, 2011 5:44 AM
    Thursday, September 15, 2011 5:38 AM
  • Thank you Amreek!!

     

    You are right.

    What I need was the "EntityFilters".

    It worked all fine!!

     


    Taichi,Sato
    Thursday, September 15, 2011 5:44 AM