Sameer Ahmed S
Sameer Ahmed S

Reputation: 1683

DriveItem ID has exclamation in item id and not able to retrieve worksheets from the workbook stored in onedrive using microsoft graph api

Not able to retrieve the list of worksheet from the workbook stored in the onedrive through microsoft graph API.

Following API provide the list of workbooks on my ondrive account https://graph.microsoft.com/v1.0/me/drive/root/search(q='.xlsx')?select=name,id,webUrl

return

{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(driveItem)",
"value": [
    {
        "@odata.type": "#microsoft.graph.driveItem",
        "name": "OnlineArticle.xlsx",
        "id": "7CFB16EE6D5730EF!53780",
        "webUrl": "https://1drv.ms/x/s!AO8wV23uFvt8g6QU"
    }]}

but when we try to get the worksheet from this workbook using following API i.e. https://graph.microsoft.com/v1.0/me/drive/items/7CFB16EE6D5730EF!53780/workbook/worksheets

we get following error

{
"error": {
    "code": "ResourceNotFound",
    "message": "Resource not found.",
    "innerError": {
        "request-id": "123139d9-bf93-46ab-8e2a-c139f7b4996f",
        "date": "2017-05-31T06:42:05"
    }
}}

we have consumer account and id of the drive item has '!' separator. would appreciate if any can help us to retrieve the list of worksheet from the our workbook using microsoft graph for our consumer service account i.e. office 365 home subscription.

Upvotes: 1

Views: 431

Answers (1)

Marc LaFleur
Marc LaFleur

Reputation: 33094

Currently Graph's Excel APIs only support Office 365 accounts (OneDrive for Business, Groups Drives, etc.).

Based on the ID here, this looks like a consumer OneDrive (consumer drives include a ! in the IDs) which is why the API is failing. Consumer OneDrive support should be coming to the beta endpoint very soon. At the moment however this scenario isn't supported.

Upvotes: 2

Related Questions