0

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?

Zak
  • 48
  • 5
  • 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 [thread](https://sharepoint.stackexchange.com/questions/274172/the-x0020-of-the-internal-name-for-a-sharepoint-column) – Shiva Keshav Varma Sep 17 '20 at 13:06
  • Did it work for you? – Shiva Keshav Varma Sep 18 '20 at 08:19
  • 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 Sep 21 '20 at 10:07

1 Answers1

1

@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

Baker_Kong
  • 1,739
  • 1
  • 4
  • 9