0

I have a custom app (actually an R package) that uses the Graph API to talk to Sharepoint. One of my users has reported that they are unable to list files in folders: either a 404 or 400 error is returned. They can open and download files as long as they know the full path, they just can't get directory listings.

The code to read a directory uses either of the following Graph calls, based on whether it's the root directory:

GET drives/{id}/root/children
GET drives/{id}/root:/path/to/folder/:children

I've tested it on my machine and it works. Are there admin settings or policies that might be causing this problem?

1
  • Just to clarify: the user is in another tenant, not mine. The package is publicly available and can be used in any tenant, assuming the admin grants the necessary permissions. Commented Mar 25, 2021 at 2:32

2 Answers 2

0

Here's the accurate syntax for using Graph REST API to list SharePoint list items

GET https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items
GET https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items?expand=fields
GET https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items?expand=fields(select=Column1,Column2)

Reference:

https://docs.microsoft.com/en-us/graph/api/listitem-list?view=graph-rest-1.0&tabs=http

0

Problem solved, it was a bug in my code.

(Gory details: there is an R file.path function that takes a number of arguments and combines them using slash separators /: eg file.path("a", "b", "c") == "a/b/c". If the last argument is an empty string "", on Windows this is ignored but on Linux/Mac it results in a trailing slash. This breaks my code. Must do proper multi-platform tests....)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.