Graph SharePoint Sites API create list item fails with 500 status

jdbadg 1 Reputation point
2022-05-20T15:38:15.34+00:00

I am trying to create a list item in a SharePoint list via MS Graph API v1 using an application (msal.ConfidentialClientApplication) registered with my tenant with the appropriate permissions assigned (Sites.Selected granted by another application with Sites.FullControl.All). I receive a 500 response to each request. I have no issues retrieving data from the site in question or its lists.

I'm pretty sure my request is properly formatted. Here are the relevant components of the request :

url = f"https://graph.microsoft.com/v1.0/sites/{site_id}/lists/{list_id}/items"
headers = {"Authorization": f"Bearer {token}", "Accept": "application/json", "Content-Type": "application/json"}
method = POST
data =JSON string

When I began testing, I did get some 400 responses due to some typos in field names. Since I've fixed those issues, I'm getting 500 responses only.

Please let me know if there is any more information I can share to help resolve this issue.

Microsoft Security Microsoft Graph
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Zehui Yao_MSFT 5,876 Reputation points
    2022-05-23T02:22:39.687+00:00

    Hello @jdbadg , I tested locally with sites.selected permission and it works successfully. According to your error message 500, this usually leads to an internal service error. You can provide the request_id and timestamp of the error so that we can investigate the background log to find the cause of the problem.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.