Graph - How to update field 'name' of a custom column with a SharePoint list ?

LPFreelance 1 Reputation point
2023-06-20T14:42:38.2433333+00:00

Hello,

I'm trying to update the name of a custom column using Graph Explorer. I'm login with permission Sites.Manage.All.

Here is the request I'm using:

PATCH /sites/{site-id}/lists/{list-id}/columns/{column-id} HTTP/1.1

{"name": "MyNewName"}

Note: ids are well defined and works, running request with GET method returns the columnDefinition.

Executing this request returns a 200 OK response. But the JSON body with the column's data is still showing the previous name. It has no effect. However the documentation says:

For columns in site or list, you can update any property of columnDefinition other than the id property.

To my knowledge, I should be able to update the field name.

Do you have any clue as to why it doesn't work? Any help would be much appreciated.

Edit: I've also tried when there is no item in the list, just in case, issue is still present.

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. RaytheonXie_MSFT 40,471 Reputation points Microsoft External Staff
    2023-06-21T03:13:32.42+00:00

    Hi @LPFreelance

    Per my research, the property of sharepoint column name should be displayName but not name. The request should be like following

    PATCH /sites/{site-id}/lists/{list-id}/columns/{column-id} 
    {"displayName": "MyNewName"}
    

    You can see the response in the document

    User's image


    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.

    1 person found this answer helpful.

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.