Share via

Error while adding the content/webpart to the SharePoint page using the graph Api

Ravi Kataria 20 Reputation points
2025-03-21T16:29:54.5633333+00:00

Error in adding the content into the SharePoint page using Graph Api

Below is the API details and error details hl

PATCH /sites/{site-id}/pages/{page-id}/microsoft.graph.sitePage

Most pages have worked so far, some of them we had to modify a bit because there were some empty webparts created inside sharepoint that we were not able to upload as null, but for one page we have this error returned when uploading it and we are not able to figure it out:

 {"error":{"code":"invalidRequest","message":"The web part (type=cbe7b0a9-3504-44dd-a3a3-0e5cacd07788) has invalid value: ArrayItemNotValid: #/authors[0]\n{\n  PropertyRequired: #/authors[0].upn\n}\n;","innerError":{"code":"badArgument","date":"2025-02-22T21:18:53","request-id":"a34764dd-8df8-4d0e-9f6d-99c0f8608429","client-request-id":"editedOutClientRequestIDForPrivacy"}}}

How to fix above error? Any help will be appreciated, thanks in Advance.

Microsoft Security | Microsoft Graph
0 comments No comments

Answer accepted by question author

Pardha Saradhi Reddy Jaladi-MSFT 550 Reputation points Microsoft External Staff
2025-03-21T20:14:46.7566667+00:00

Hello Ravi Kataria,

Thank you for reaching out to Microsoft Support!

The error you're encountering indicates that the authors property of the web part is missing a required field, specifically the upn (User Principal Name) for the first author in the array. Here's how you can resolve this:

Understand the Error:

  • The error message specifies that the authors[0].upn property is required but is missing or invalid. This means the web part you're trying to upload has an incomplete or incorrect authors array.

Inspect the Web Part Data:

  • Review the JSON payload you're sending in the PATCH request. Specifically, check the authors array for the web part with the type cbe7b0a9-3504-44dd-a3a3-0e5cacd07788.
  • Ensure that each author in the array has a valid upn (User Principal Name). For example:
    JSON format:
    "authors": [ {
    "upn": "user@example.com"
    
    } ]

Modify the Payload:

  • If the authors array is empty or missing, populate it with valid author data. If you don't have specific authors to assign, you can use a placeholder or default user with a valid upn.

Validate the Web Part Configuration:

  • Ensure that all required properties for the web part are included in the payload. Refer to the Microsoft Graph API documentation for site pages to confirm the required fields.

Retry the Request:

  • After updating the payload, send the PATCH request again to update the page. Verify that the response indicates success.

Additional Tips:

  • Use the Graph Explorer to test your API requests and validate the payload.
  • Check the permissions of the app making the request. Ensure it has the necessary permissions to update site pages in SharePoint.

If you still encounter an issue, I would recommend you to raise a support case with Microsoft Graph, a Support Engineer will be able to look into this issue and assist you better. You can raise support ticket from New support request - Microsoft Entra admin center or https://admin.microsoft.com/#/support/requests.

Hope this helps.

If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.

Was this answer helpful?

1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

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