SharePoint 365, Graph API and Custom List Data - MetdaData

ItsRainMan 0 Reputation points
2023-04-21T08:25:23.8633333+00:00

Hello, Is it possible using Graph API to update custom list data in SharePoint 365. I am currently trying this through Graph Explorer before writing vb.net code based on a working example. I already have the code that authenticates the user, gets the drive, file id etc and can wirte back to a standard list item like 'description' but when you try to write back to a custom column, the repsonse is 'Bad Request'. In Graph the behaviour is the same. Below is an example of the current values on a file in one of our SharePoint sites. User's image

I can use the Graph Explorer Site and a 'PATCH' command with the below: https://graph.microsoft.com/v1.0/sites/<Tentant Information>/drives/<ID>/root:/<folder 1>/<folder 2>/<File Name>.pdf: { "description": "Changed" } This then updates the Sharepoint item as below: User's image

The custom column I would like to update is Certificate No, this is stored in Sharepoint as Certificate_x0020_No My theory was to change: { "description": "Changed" } to { "certificate_x0020_no": "1234" } I get the response Bad Request Error 400. I beleive that the Graph explorer expects the column id in lower case but have tested the below with the same result every time: certificate no Certificate No Certificate_x0020_No So can the custom colums be updated or am I using the worng method? Thanks T

Microsoft 365 and Office SharePoint Development
Microsoft 365 and Office SharePoint For business Windows
Microsoft Security Microsoft Graph
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. TH-4749-MSFT 3,315 Reputation points
    2023-04-21T16:11:40.4133333+00:00

    Hi ItsRainMan, Thanks for reaching. The api call you are running only permits updating properties of the list item such as description etc. I was able to repro the error you received for the api call while modifying the custom column. Running the call https://graph.microsoft.com/v1.0/sites/<Tentant Information>/drives/<ID>/root:/<folder 1>/<folder 2>/<File Name>.pdf returns document properties only, hence custom column values of the document cannot be modified with that api call. To update custom columns, you can try the method in article. Thanks.


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.