Microsoft has three api for OneDrive, one API for the personal OneDrive, one API for OneDrive for Business and the newer GraphAPI, which supports both OneDrive variants. I will introduce how to create the one API for OneDrive for Business. Maybe the next post for the GraphAPI
Notice: The APIs only work with the accounts, which of Office 365 domain have been verified by the organization/admin. If not, you can only use the account with official OneDrive client and web page.
- Use your office365 account to login this website.
https://portal.azure.com/ - Check the permission which you need to create the API:
Azure Active Directory–>User settings–>App registrations(Users can register applications).
If YES, you have the permission. Or you cannot create the api. The default setting is YES with the organization which has verified your Office 365 domain.
- Create your own app:
Azure Active Directory–>App registrations–>New application registration
- Name–>”any”,Sign-on URL–>”https://login.microsoftonline.com/”–>Create
- The Application ID is “api_client_id”,Click the app has created and go to setting.
setting–>Properties–>Multi-tenanted
If you select the Multi-tenanted is YES, the API can be used with other organizations, which have the different domain to yours. And the “App ID URI” doesn’t need to change. If you choose NO, the API just can be used with the same domain account.
- Fill in the Reply URLs(depend on the software you use):
setting–>Reply URLs–>”https://onedrive.live.com/about/business/”
If you use the rclone, fill in “http://localhost:53682/”.
- Set the api permission:
“Windows Azure Active Directory” is default to “Sign in and read user profile”.
What you need to do just add “Office 365 SharePoint Online” with the “Read user files” and “Read and write user files” permission.
setting–>Required permissions–>Add–>1 Select an API–>”Office 365 SharePoint Online”–>Select–>2 Select permissions–>”Read user files” & “Read and write user files”–>Select–>Done.
- Finally, obtain the api_client_secret:
setting–>Keys
Description–>”any”,Expires–>”Never expires”,Save.
Click the save botton. And see the api_client_secret in the “value” field. Copy the api_client_secret and save it. It cannot be seen again once you leave the page. If you lose it, just create keys again.