Unable to update Sharepoint listitem with Microsoft GraphAPI in Python

Shankar, Pankaja 1 Reputation point

Steps to reproduce:

  1. Create a new list with data given as { "displayName": "Books_2", "columns": [ { "name": "Book_author", "text": {"value": "JJ Solomon"} }, { "name": "Book_title", "text": {"value": "Computer Graphics"} } { "name": "Publication_year", "text": {"value": "1990"} } ], "list": { "template": "genericList" }
  2. Create the listitems - works both in Postman and Python script with POST
  3. Lastly when I try to update one of the listitems I get a 400 BadRequest error, I even provided with the item etag, still the same error.

Below works fine in Postman but not in Python script using as a PATCH request

PATCH https://graph.microsoft.com/v1.0/sites/<my-siteid>/lists/<my-listid>/items/7/fields

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
9,918 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Shivam Dhiman 5,866 Reputation points

    Hi @Shankar, Pankaja

    400 BadRequest error indicates that the request is invalid. By looking at the endpoint provided it seems like there is an issue in Payload.

    Please make sure the field provided in Body is present in your SharePoint list.

    Also please make sure while updating field you are using internal value of the column.
    Please follow the below sample screenshot to get Internal value of your field.

    • Go to your list settings.


    • Under columns got that particular column.


    • In the above URL you can get field Internal Value which you need to use in Payload


    After using the internal value, I am able to update that field. Please refer to the below sample screenshot:enter image description here

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote. If you have any further questions about this answer, please click Comment.

    0 comments No comments