Sharepoint access public folder via REST API without authentication

100 views Asked by At

Is it possible to access a folder, which I made publicly accessible via link, from the SharePoint REST API (without beeing authenticated)?

Currently when I try to access: https://<tenant>.sharepoint.com/sites/<site>/_api/web/GetFolderByServerRelativeUrl('Freigegebene%20Dokumente')/Folders I get a UnauthorizedAccessException

However when I navigate to the shared link once (without beeing authenticated). It seems like some cookies get set and then the REST request works as well!

How can I assure the REST request works, without the need to first access the shared link?

1

There are 1 answers

0
MadLuca On BEST ANSWER

It seems like it is not possible to access public folders/files via the REST API.

To access the files and folders I solved this by registering an application with the Microsoft Identity platform and using the Microsoft Graph API to access the files and folders in the SharePoint site.