Zak
Zak

Reputation: 48

How do I escape a Sharepoint column name in Microsoft Graph?

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?

Upvotes: 0

Views: 867

Answers (1)

Baker_Kong
Baker_Kong

Reputation: 1889

@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

Upvotes: 1

Related Questions