ItemNotFound - Graph API Excel Workbook

Cavas, Martin 21 Reputation points
2022-11-07T17:10:18.517+00:00

Dear Graph API Enthusiasts and others!

I am facing a problem. Everything goes fine including creating a createSession (persisent mode). I am kind of lost to be honest and I hope I will find the answer inside this community.

Situation:

I have an excel file stored inside Sharepoint site. I am able to fetch the ID of this document and I stored it inside item-id variable.
This document is an excel file (.xlsx). This file contains 1 worksheet called Sheet1. Inside Sheet1 there is a table, the table is called Table3. It is a named table.
I want to add rows in this table starting from.. I suppose.. index 0. My endpoint looks like this:

request url: https://graph.microsoft.com/v1.0/drive/items/{item-id}/workbook/worksheets/{worksheet-name}/tables/{table-name}/rows/add

While I fill up all the valid identifiers, the outcome of the call is a 404 - ItemNotFound - The resource could not be found.

The permissions set: Sites.Read.All Sites.ReadWrite.All Files.ReadWrite

What am I missing here? Kind of frustrating, when everything works but this call does not work. I have tested something, all of the calls inside the Graph API section Workbook are not working for the given Item-ID that I provide. Any other call outside of this section is able to deliver and manipulate information based on the given (same) item-id. Whats going wrong here?
The section, including the Add Row call: https://learn.microsoft.com/en-us/graph/api/resources/excel?view=graph-rest-1.0

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,550 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,662 questions
{count} votes

Accepted answer
  1. Shivam Dhiman 5,946 Reputation points
    2022-11-08T09:51:16.577+00:00

    Hi @Cavas, Martin

    When you are using https://graph.microsoft.com/v1.0/drive/items/{item-id}/workbook/worksheets/{worksheet-name}/tables/{table-name}/rows/add this graph endpoint is checking that file on default site.
    Since this item is not present in default site you were getting this error and this POST https://graph.microsoft.com/v1.0/sites/{site-id}/drives/{drive-id}/items/{item-id}/workbook/worksheets/Sheet1/tables/table3/rows/add endpoint its working fine.

    You can also use POST https://graph.microsoft.com/v1.0/drives/{drive-id}/items/{item-id}/workbook/worksheets/Sheet1/tables/table3/rows/add Graph API endpoint where drive-id is the Specific site drive-id where item is present.

    Hope this helps.

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

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Aleksandar Salevski 0 Reputation points
    2023-11-28T12:33:06.8533333+00:00

    Hi gyus, this is not working in my scenario, i have the right app permissions, for user,site an files.

    User's image

    User's image

    0 comments No comments