Search code examples
c#odatadynamics-crmdynamics-crm-2016dynamics-crm-webapi

How to implement RetrieveAttributeRequest via Odata?


In order to get OptionSet information, we can issue a request:

// Create the request
RetrieveAttributeRequest attributeRequest = new RetrieveAttributeRequest
{
    EntityLogicalName = Contact.EntityLogicalName,
    LogicalName = "new_string",
    RetrieveAsIfPublished = false
};

// Execute the request
RetrieveAttributeResponse attributeResponse =
    (RetrieveAttributeResponse)_serviceProxy.Execute(attributeRequest);

Console.WriteLine("Retrieved the attribute {0}.",
    attributeResponse.AttributeMetadata.SchemaName);

Is there a way to do this using an Odata request in crm 2016?


Solution

  • Yes you can, Use the Web API with Dynamics 365 metadata.

    I suggest you look at the OptionSetMetadata, found at [Organization URI]/api/data/v8.2/GlobalOptionSetDefinitions