| AJS 4.x
Manual | Note! This Manual is for the "Windows authentication" version, which is designed to work with existing Windows server or Active Directory accounts and Windows authentication. If you want to create accounts by yourself and store their credentials in your own HTTP Commander XML database, you need to download the "Forms authentication" version! This Manual is for the Windows authentication version only! | Web file manager Free Installation assistance Manual Home page

Microsoft OneDrive for Business integration

OneDrive for Business is a personal library intended for storing and organizing your work documents. As an integral part of Office 365 or SharePoint Server 2013, OneDrive for Business lets you work within the context of your organization, with features such as direct access to your organization’s address book. More info: What is OneDrive for Business?, OneDrive for Business.

For work with files from HTTP Commander (create/edit documents, download/upload files, folders) stored in the OneDrive for Business, follow these steps.

### If you already have Office 365 account and valid subscription, then proceed directly with Application configuration.

- If you do not have an Office 365 account, then you can select the desired plan and register, or try the free trial period.
  Screenshots

  For more info see Get an Office 365 account to access Office 365 APIs.
- Create a Microsoft Azure subscription for your Office 365 tenant. For this:
  - Log in to your Office 365 tenant and go to the Office 365 admin center
    (from the Home page, select the Admin icon to open the Office 365 admin center).
    Screenshot

  - In the menu page along the left side of the page, scroll down to Admin centers icon and select Azure AD.
    Screenshot

    Important To open the Office 365 admin center, and access Azure AD, you'll need an Office 365 business account with global administrator privileges.
  - Create a new subscription.
    If you're using a trial version of Office 365, you'll see a message telling you that Azure AD is limited to customers with paid services. You can still create a trial 30-day Azure subscription at no charge, but you'll need to perform a few extra steps:
    - Select your country or region, and then click Azure subscription.
    - Enter your personal information. For verification purposes, enter a telephone number at which you can be reached, and specify whether you want to be sent a text message or called.
    - Once you've received your verification code, enter it and click Verify code.
    - Enter payment information, check the agreement, and select Sign up.
      Your credit card will not be charged.
      Do not close or refresh your browser while your Azure subscription is being created.
    Screenshot

  - Once your Azure subscription is created, choose Portal or Start managing my service.
    Screenshot

  - You should now see all items in your Azure subscription. It lists a directory with the name of your Office 365 tenant.
    Screenshot

    For more info see Associate your Office 365 account with Azure AD to create and manage apps.
- Register your HTTP Commander application in Microsoft Azure Active Directory.
  - Sign into the Microsoft Azure Portal using your Office 365 credentials.
  - Select the Azure Active Directory on the left side ( if it is not there click on in More services > at the bottom of the list in the left column and filter services to find Azure Active Directory).
    Screenshot

  - Select the App registrations and then click on New application registration at the top of the screen.
    This will bring up a dialog box to tell Microsoft Azure about your HTTP Commander application.
    Screenshot

  - Enter the name of the HTTP Commander application.
    Leave the Type as Web app/API.
    For the SIGN-ON URL enter the URL in which you enter the HTTP Commander application.
    For example: https://yourdomain/HTCOMNET/Default.aspx.
    Screenshot

  - Click on "Create" button to complete adding the application. You get a notification that the application has been added successfully.
    For more info see Get started with Office 365 APIs in apps.
- HTTP Commander settings for create/edit documents in Office 365 or access to files stored in OneDrive for Business.
  - Go to Settings tab of HTTP Commander Admin Panel. If the hidden settings are not visible, then click Show hidden paramters button on toolbar of Settings tab.
  - For the parameters EnableDownloadToSkyDrive, EnableUploadFromSkyDrive (section UploadDownload) or-and EnableMsOfficeOnlineEditor (section Office) set values to true.
  - If you are not already logged in to your Microsoft Azure account, log in.
    Navigate to Azure Active Directory service → choose your directory → App registrations
    Screenshot

  - Click Endpoints icon on the top of the screen. Copy the URL of OAUTH 2.0 AUTHORIZATION ENDPOINT and paste it into the hidden parameter OneDriveForBusinessOAuth2Endpoint (section Office).
    Screenshot

  - Then choose created the HTTP Commander application and copy the value of the Application Id field and paste it into the hidden parameter OneDriveForBusinessAppClientID (section Office).
    Screenshot

  - Open the Reply Urls section of application settings. In the REPLY URL field (value should already exist) replace Default.aspx with Handlers/OneDriveForBusinessOAuthHandler.ashx.
    Screenshot

  - Open the Keys section of application settings.
    Set key description and select key validity period of the application.
    Click Save button on the top and after saving, copy the key value and paste it into the hidden parameter OneDriveForBusinessAppKey (section Office).
    Screenshot

  - Open the Required permissions section. Click on the "Add" button on the top and then "Select API". Select the Office 365 SharePoint Online API
    Screenshot

    and select the Delegated Permissions as shown below:
    - Read managed metadata
    - Read and write user files
    - Read user files
    - Read user profiles
    Screenshot

  - For the hidden parameter OneDriveForBusinessRootUrl (section Office) set root URL to access OneDrive for Business. This url has the form https://yourcompanyname-my.sharepoint.com.
  - Note! All of these four parameters (OneDriveForBusinessRootUrl, OneDriveForBusinessAppClientID, OneDriveForBusinessAppKey, OneDriveForBusinessOAuth2Endpoint in section Office) are required if you want to use integration with OneDrive for Business.
  - After setting the values ​​do not forget to save your HTTP Commander settings (Save settings button on the toolbar of Settings tab) and restart the application (Restart application button).
- Also for more info see Manually register your app with Azure AD so it can access Office 365 APIs.

For more info see also Register your app for OneDrive for Business manual.

After performing these steps, your users with corporate accounts OneDrive for Business (as <username>@<yourcompanyname>.onmicrosoft.com) can download/upload your files using the items Cloud storages → download to... / upload from... → OneDrive in context menu or on the toolbar; or can create/edit documents in Office 365 Online.
Screenshot

Note 1. If when opening the file list you receive an error:
The requested resource is being automatically provisioned. Please try again in a few minutes. (ItemNotFound)
Screenshot

it is necessary to come into your OneDrive for Business (from the Home page, select the OneDrive icon) via the browser and to wait some minutes so far to be performed setting up of your storage
Screenshot

Note 2. If in case of log in you receive an error:
AADSTS90093 – Calling principal cannot consent due to lack of permissions
Screenshot

that needs to be checked (and to set if necessary) the Delegated permissions
Screenshot

Note 3. If in case of log in you receive an error:
AADSTS50011: The reply address ... does not match the reply address configured for the application
Screenshot

that need to be checked (and to set if not exists) REPLY URL property. See Reply Url article.