2

I am trying to get the dropdown fields within a sharepoint list via the _api. See Image below:

enter image description here

https://one365dev1.sharepoint.com/sites/nieuwsportaal/_api/web/lists/getByTitle('Nieuwsberichten')/items?$select=Hoofdcategorie&$expand=FieldValuesAsText

I used the api endpoint above but then I realized that I am getting the items and thus not all values of "Hoofdcategorie". I am clueless however if there is any other way to get the items of the dropdown list of a field?

any help is much appreciated. Cheers.

3

Try this

https://one365dev1.sharepoint.com/sites/nieuwsportaal/_api/web/lists/GetByTitle('List Name')/fields?$filter=EntityPropertyName eq 'Choice Field Name'
3

Option 1

The endpoint you need to hit is as below:

https://one365dev1.sharepoint.com/sites/nieuwsportaal/_api/web/lists/getByTitle('Nieuwsberichten')/fields?$filter=EntityPropertyName eq 'Hoofdcategorie'

In the json, the values would be retrieved somewhat as :

data.d.results[0].Hoofdcategorie.results

Generic endpoint:

/_api/web/lists/GetByTitle('List Name')/fields?$filter=EntityPropertyName eq 'Choice Field Name'

In the json, the values can be retrieved as :

data.d.results[0].Choices.results

where choices = internal name of the choice column

Option 2

There is also another way to get choice fields as below. It relies on the field display name:

https://one365dev1.sharepoint.com/sites/nieuwsportaal/_api/web/lists/getByTitle('Nieuwsberichten')/fields/getbytitle('Hoofdcategorie')

Reference - Get Fields by title

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.