Add a new choice option to a Choice site column in SharePoint Online using SharePoint REST API

Copper Contributor

Hi!

 

I am trying to add a new choice option to a Choice site column in SharePoint Online using SharePoint REST API. The choice site column is added to a content type and the content type is added to a SharePoint List.

 

While I am able to add a new choice option to the site column using below REST API, the changes are not pushed to the SharePoint List when updating a site column. Am I missing something here or is there a way to trigger the update to push the changes to all list columns based on this site column?

 

REST EndPoint - https://abc.sharepoint.com/_api/web/fields('guid')

Body - {"__metadata": {"type": "SP.FieldChoice"},
"Choices": {"__metadata": {"type": "Collection(Edm.String)"},
"results": ["Choice1",
"Choice2",
"Choice3",
"Choice4",
"New Choice"]
}}

CSOM has updateAndPushChanges method to trigger the update. However I am unable to find equivalent REST endpoint.

https://abc.sharepoint.com/_api/web/fields('guid')/updateandpushchanges(true) returns the following

{
"error": {
"code": "-1, Microsoft.SharePoint.Client.ResourceNotFoundException",
"message": {
"lang": "en-US",
"value": "Cannot find resource for the request updateAndPushChanges."
}
}
}

 

3 Replies

Hi @Sandy5k,

 

The GUID is a protected column. I found an interesting tutorial for you with several steps to use it anyway, look at this.

manipulating_GUID_as_site_column.png

 

Hope that helps. Greets, Eva.

Hi @Eva Vogel

 

Thank you for the response. However I am looking for updating a site column and pushing the changes to the Lists based on the site column using REST API.

@Sandy5k 

 

Did you figure out how to do this ???

 

I want to do something similar from a flow