2
votes

how to get worksheets of a shared workbook /workbook/worksheets. I am able to get worksheets for personal workbooks but get invalid resource for shared workbooks

1
Have you checked all scopes? Maybe for a shared workbook you need a different one - Petaflop
Yes, I have checked all scopes. There is no documentation for a different scope required for shared workbooks. - Viraf

1 Answers

1
votes

Finally got it to work!

In order to get workseets of shared workbooks in office 365 need to use the following endpoint

https://graph.microsoft.com/v1.0/drives/{remoteItem.parentReference.driveId}/items/{remoteItem.id}/workbook/worksheets

In order to get {remoteItem.parentReference.driveId} and {remoteItem.id} use following endpoint

Thanks to @Petaflop for suggesting to check all the scopes. For some reason the you can list the files using Read permisson but need Read.All for listing the worksheets.(@Petaflop would have given your answer the tick if it were not deleted :))

https://graph.microsoft.com/v1.0/me/drive/search(q='.xlsx')?select=name,id,parentReference