0
votes

I'm performing the following request to update the value of "ExampleColumn#" for a Sharepoint Online item:

PATCH https://graph.microsoft.com/v1.0/sites/{site_id}/lists/{list_id}/items/{item_id}

With the following request body:

{
    "fields":{
        "ExampleColumn#": 1
    }
}

Returns a 400 bad request error, with the following message:

"message": "A metadata reference property was found in a JSON Light request payload. Metadata reference properties are only supported in responses"

As I believe Odata requires the "#" symbol to be escaped, I've tried using percent-encoding which I couldn't get to work.

Request Body:

{
    "fields":{
        "ExampleColumn%23": 1
    }
}

Response:

"message": "Field 'ExampleColumn%23' is not recognized"

What should I be doing differently in my request body?

1
You can use this call GET https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items/{item-id}/fields to get the fields present for that item and you will see the right column name there how they are modified. In your case For '#' it is converted internally as 'x0023' that means for your field it becomes 'ExampleColumn_x0023_'. In the same way for space(' ') it converts to 'x0020'. Please go through this threadShiva Keshav Varma
Did it work for you?Shiva Keshav Varma
Hi, @Shiva-MSFTIdentity, that definitely did work for me, thanks! Was a bit odd as with the request to create those columns initially "ExampleColumn#" is accepted as the api facing name for the column - I assume Sharepoint then converts this to x0023 afterwards. Thanks for the help though and the thread to read!Zak

1 Answers

1
votes

@Zak,

Please make sure the field in the request body is the correct internal name of that column. I am able to update a column value in my SPO list via the below request:

enter image description here

You can get the field internal name through its setting page:

enter image description here