Working with the application folder¶
An app that only needs to keep its own files shouldn't ask for the user's whole
drive. OneDrive reserves a private approot special folder for exactly this:
with the Files.ReadWrite.AppFolder scope the app sees only that folder, and the
user sees it under Apps. Least privilege in practice.
Reach the app folder¶
Special folders are named, not pathed — reach them through the special collection.
app_folder = client.me.drive.special["approot"].get().execute_query()
print(app_folder.name, app_folder.web_url)
Store app state in it¶
Everything under approot is scoped to your app.
Requires the delegated
Files.ReadWrite.AppFolderscope (notFiles.ReadWrite).
https://learn.microsoft.com/en-us/onedrive/developer/rest-api/concepts/special-folders-appfolder