web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Answered

How to get picklist values in console application

(0) ShareShare
ReportReport
Posted on by 10

I want "Male" or "Female" instead of 1 or 2 in my response can any one help me with this.

Below is my code,

var response = client.GetAsync("contacts?$select=firstname,gendercode&$top=2").Result;

if (response.IsSuccessStatusCode)
{

     JObject body = JObject.Parse(response.Content.ReadAsStringAsync().Result); 
     Console.WriteLine("{0}", body);
}

else
{
     Console.WriteLine("Error : " + response.ReasonPhrase);
}

I have the same question (0)
  • Community Member Profile Picture
    on at
    RE: How to get picklist values in console application

    Hi partner,

    The picklist values you mentioned are values of optionset field?

    The optionset field have value and label, what you need is label not value.

    pastedimage1625128645630v1.png

    Maybe you can refer following link to get optionset field label:

    Retrieve table definitions by name or MetadataId (Microsoft Dataverse) - Power Apps | Microsoft Docs

    Regards,

    Leah Ju

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.

  • Verified answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: How to get picklist values in console application

    Hello,

    The easiest way is to include an additional header to your request. Check more information here - bengribaudo.com/.../dataverse-web-api-tip-formatted-values

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 51 Super User 2025 Season 2

#2
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 42

#3
CU23101130-0 Profile Picture

CU23101130-0 17

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans