Update Sharepoint Drive metadata

Omar BELHASSINE 0 Reputation points
2023-08-16T08:37:52.6766667+00:00

HELLO

I would like to know if it's possible to update a custom metadata using the Graph API.

In my tests, I was able to update the standard created metadata (like the name) but not the ones I have created myself.

Best regards,

Belhassine

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
13,538 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
11,229 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. ChengFeng - MSFT 5,045 Reputation points Microsoft External Staff
    2023-08-17T05:40:59.1833333+00:00

    Hi @Omar BELHASSINE

    Here is link about Add custom data to resources using extensions for your reference:

    https://learn.microsoft.com/en-us/graph/api/resources/searchrequest?view=graph-rest-1.0

    According to the link, you can use different types of extensions to add custom data to resources, such as users, groups, or devices.

    One of the options is to use open extensions, which are untyped name-value pairs that can be added to any resource.

    To update an open extension, you can use the PATCH method with the following syntax:

    PATCH /{resource}/{id}/extensions/{extensionName} Content-type: application/json { “extensionName”: { “property1”: “value1”, “property2”: “value2” } }
    

    For example, if you have added an open extension named com.contoso.roamingSettings to a user with the id 1234, and you want to update the property theme with the value dark, you can use the following request:

    PATCH /users/1234/extensions/com.contoso.roamingSettings Content-type: application/json { “com.contoso.roamingSettings”: { "theme":"dark" } }
    

    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.

    Best Regards

    Cheng Feng

    0 comments No comments

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.