OneDrive for Business API


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.

  1. Use your office365 account to login this website.
    https://portal.azure.com/
  2. 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.
  3. Create your own app:
    Azure Active Directory–>App registrations–>New application registration
  4. Name–>”any”,Sign-on URL–>”https://login.microsoftonline.com/”–>Create
  5. 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.
  6. 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/”.
  7. 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.

  8. 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.

Leave a Reply

Your email address will not be published. Required fields are marked *