0

I have a Sharepoint with multiple drives that contains an Excel file (xlsx) of which I'd like to return some data.

I have successfully found the Excel file through lists with a GET: https://graph.microsoft.com/beta/sites/COMPANY.sharepoint.com:/teams/TEAM:/lists/LONGID/items/LONGID/

Which leads to the Excel file. If I try to start a session by POSTing to excelfile/workbook/createSession with { "persistChanges": false } as body, I get a "Resource not found for the segment 'workbook'" error.

Thinking it was because I was working with a listitem, I have been trying to find the file through the drive afterwards but any which way, I can not access any drives.

https://graph.microsoft.com/beta/sites/COMPANY.sharepoint.com:/teams/TEAM:/drives

Above link returns all the drives. Accessing a drive by going to

  • drives/LONGID/root
  • drives/LONGID/root/children
  • drives/LONGID/items
  • drive/LONGID/root
  • drive/LONGID/root/children
  • drive/LONGID/items

returns a "Url specified is invalid". It's the same for accessing files in the default drive.

Any help would be appreciated!

2
  • I believe there might be a problem with how URL's are handled. GETting sharepoint/lists works as well as sharepoint/lists/. GETting sharepoint/drives works but not sharepoint/drives/ This gives the invalid URL error. Commented May 12, 2017 at 13:32
  • Same issue as here. Using the new site format solved the issue. Commented May 12, 2017 at 15:48

1 Answer 1

1

You have correctly guessed that in the first case you are querying listItem which is not a driveItem. You've gotten very close to figuring out the correct URL on your own.

What you can leverage is the fact that every SharePoint list is a drive. Then, you can do the following: GET https://graph.microsoft.com/beta/sites/SITE_ID/lists/LIST_ID/drive/items/ITEM_ID/workbook/worksheets.

I use the ID notation for shortness, but the :/path: notation works for sites, lists, and driveItems.

Let me know if this still doesn't work.

Thanks,
Zlatko

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.