Using an App Folder to store user content without access to all files
The App Folder is a dedicated, special folder for your app.
The App Folder is typically named after your app, and is found in the Apps folder in the user's OneDrive.
If you request the Files.ReadWrite.AppFolder
permission scope and the user authorizes it, your app gets read and write access to this folder.
Since it behaves like any other folder in the user's OneDrive, users can add, modify, and remove content from it. Your app doesn't need to maintain logic unique to the user, which allows the user to rename or move it.
Getting authorization from the user
To have your own app's folder, you must request either the Files.ReadWrite.AppFolder
or Files.ReadWrite
permission scope when getting an access token.
For more details, see authentication.
Creating your app's folder
OneDrive creates your app's folder in the user's Apps
folder, located in the root of the user's OneDrive, when your app makes the first call to the folder using the special folder namespace.
Below are the most common calls your app can make to create the folder for the first time.
- Get your app folder's metadata:
GET /drive/special/approot
- List your app folder's children:
GET /drive/special/approot/children
- Create a folder under the approot:
POST /drive/special/approot/children
- Create an upload session:
POST /drive/special/approot:/{filename}:/createUploadSession
- Upload an item's content:
PUT /drive/special/approot:/{fileName}:/content
- Upload an item's content w/ metadata:
POST /drive/special/approot/children
- Upload an item's content from URL:
POST /drive/special/approot/children
Naming your app's folder
When OneDrive creates your app's folder, it uses the Application name set at that point for the calling app id. You may change your app's folder name in the Azure App registrations page. If you choose to do so, you may localize your app's folder name by going to the Azure App registrations page and editing your app's localization settings. Changing your app's folder name in the Azure App registrations page will not rename existing special folders associated with your app.
Working with your app's folder
Your app's folder supports all the standard item
operations.
Common task | HTTP method (by path) |
---|---|
Get metadata for an Item | GET /drive/special/approot:/{path} |
List an Item's children | GET /drive/special/approot:/{path}:/children |
Create an Item | PUT /drive/special/approot:/{parent-path}/{name} |
Upload an Item's contents | PUT /drive/special/approot:/{parent-path}/{name}:/content |
Update an Item's contents | PATCH /drive/special/approot:/{path} |
Delete an Item | DELETE /drive/special/approot:/{path} |
Move an Item | PATCH /drive/special/approot:/{path} |
Copy an Item | POST /drive/special/approot:/{path}:/action.copy |
Download an Item's contents | GET /drive/special/approot:/{path}:/content |
Download specific file format | GET /drive/special/approot:/{path}:/content?format={format} |
Search for an Item | GET /drive/special/approot:/{path}:/search |
View changes on an Item | GET /drive/special/approot:/{path}:/delta |
Get thumbnails for an Item | GET /drive/special/approot:/{path}:/thumbnails |