How to update a SharePoint column with Graph API?

omg_math 0 Reputation points
2024-06-10T12:11:41.27+00:00

Hi there

I'm trying to update the column value of a column I created on a SharePoint site. I found this blog post which describes how to do this.

On my test site this worked out. However, on the prod site I get the following error with code 403:

{
    "error": {
        "code": "accessDenied",
        "message": "Request was cancelled by event received. If attempting to delete a non-empty folder, it's possible that it's on hold",
        "innerError": {
            ...
        }
    }
}

Therefore my questions are the following:

  • What does that error mean and how can I resolve it?
  • The error code is a 403, meaning forbidden. What kind of permissions does my app need to achieve this? Update: It currently has the following relevant for SharePoint:
    • Files.ReadWrite.All
    • Sites.FullControl.All
    • Update 2: Figured out that the 403 only happens for sites connected to MS-Teams!
  • Is there another way to update a column value on SharePoint that I can/should try?

Thanks for your help!

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

2 answers

Sort by: Most helpful
  1. Maycon Batista 336 Reputation points
    2024-06-10T13:28:24.4266667+00:00

    Hello, you will need the following permissions:

    "Sites.ReadWrite.All if you register an app or Delegate "Sites.ReadWrite.All".

    https://learn.microsoft.com/en-us/graph/api/listitem-update?view=graph-rest-1.0&tabs=http

    If there are any misunderstandings, please let me know

    Best regards,

    Maycon Novaes

    If the Answer is helpful, please click "Accept Answer" and upvote it.


  2. RaytheonXie_MSFT 40,471 Reputation points Microsoft External Staff
    2024-06-11T01:58:01.5366667+00:00

    Hi @omg_math,

    For the error message Request was cancelled by event received. If attempting to delete a non-empty folder, it’s possible that it’s on hold.

    It usually happens when your site is on hold, which is related to retention policies implemented by your Microsoft 365 Admin to prevent data loss. The users can be restricted from editing moving or deleting. Please check if you have apply the policy on your site. You could verify it from the Microsoft Purview compliance portal, select Data lifecycle management > Microsoft 365 > Retention Policies, or select Data Loss Prevention > Policies.


    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.