Unable to create worbook session to read sharepoint driveItem

Hudson Spangler 21 Reputation points
2021-10-13T03:10:48.807+00:00

I have a link to a sharepoint excel file. I've followed the instructions here to encode the link and can access its driveItem object via

https://graph.microsoft.com/v1.0/shares/u!aHR0cHM6Ly9hZG1pbmxpdmV1bmMuc2hhcmVwb2ludC5jb20vOng6L3MvQ2xpbmljQWRtaW5pc3RyYXRpb24vRVg1cURzdUhFb05Na1RWREFKcUIxazBCQUNRcWlUVFZiZHNWTWxjamdQeWMxZz9lPVJ2eDZabg=/driveItem

I need to programmatically read the actual data within the link.

Im using this resource https://learn.microsoft.com/en-us/graph/api/resources/excel?view=graph-rest-1.0

but no matter what I do, I cant get the driveItem to return me a workbook item.

When I append workbook to the url:

https://graph.microsoft.com/v1.0/shares/u!aHR0cHM6Ly9hZG1pbmxpdmV1bmMuc2hhcmVwb2ludC5jb20vOng6L3MvQ2xpbmljQWRtaW5pc3RyYXRpb24vRVg1cURzdUhFb05Na1RWREFKcUIxazBCQUNRcWlUVFZiZHNWTWxjamdQeWMxZz9lPVJ2eDZabg=/driveItem/workbook

I get an error response

{
"error": {
"code": "InternalServerError",
"message": "Unable to find target address",
"innerError": {
"date": "2021-10-13T03:08:54",
"request-id": "7bcce06b-f06f-40a7-983f-a2334ba51e99",
"client-request-id": "7987a101-11ab-c854-d42f-e54e9a1fa568"
}
}
}

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,715 questions
0 comments No comments
{count} votes

Accepted answer
  1. MichaelHan-MSFT 18,016 Reputation points
    2021-10-13T07:07:51.79+00:00

    Hi @Hudson Spangler ,

    Per my test, I could reproduce the same issues on my end. Looks like it's not supported using sharingUrl to get the workbook.

    Currently, we have to get the workbook like this:

    https://graph.microsoft.com/v1.0/drives/<driveID>/items/<itemID>/workbook  
    

    You can get the driveID and ItemID in the response when accessing its driveItem.


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    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.

    0 comments No comments

0 additional answers

Sort by: Most helpful