Get started with the OneDrive connector

Connect to OneDrive to manage your files, including upload, get, delete files, and more.

With OneDrive, you:

  • Build your workflow by storing files in OneDrive, or update existing files in OneDrive.
  • Use triggers to start your workflow when a file is created or updated within your OneDrive.
  • Use actions to create a file, delete a file, and more. For example, when a new Office 365 email is received with an attachment (a trigger), create a new file in OneDrive (an action).

This article shows you how to use the OneDrive connector in a logic app, and also lists the triggers and actions.

To learn more about Logic Apps, see What are logic apps and create a logic app.

Connect to OneDrive

Before your logic app can access any service, you first create a connection to the service. A connection provides connectivity between a logic app and another service. For example, to connect to OneDrive, you first need a OneDrive connection. To create a connection, enter the credentials you normally use to access the service you wish to connect to. So, with OneDrive, enter the credentials to your OneDrive account to create the connection.

Create the connection

Prerequisites

Before you can use your OneDrive account in a logic app, authorize the logic app to connect to your OneDrive account. You can do this easily within your logic app on the Azure portal.

Authorize your logic app to connect to your OneDrive account using the following steps:

  1. Create a logic app. In the Logic Apps designer, select Show Microsoft managed APIs in the drop down list, and then enter "onedrive" in the search box. Select one of the triggers or actions:

  2. If you haven't previously created any connections to OneDrive, you are prompted to sign in using your OneDrive credentials:

  3. Select Sign in, and enter your user name and password. Select Sign in:

    These credentials are used to authorize your logic app to connect to, and access the data in your OneDrive account.

  4. Select Yes to authorize the logic app to use your OneDrive account:

  5. Notice the connection has been created. Now, proceed with the other steps in your logic app:

Use a trigger

A trigger is an event that can be used to start the workflow defined in a logic app. Triggers "poll" the service at an interval and frequency that you want. Learn more about triggers.

  1. In the logic app, type "onedrive" to get a list of the triggers:

  2. Select When a file is modified. If a connection already exists, then select the Show Picker button to select a folder.

    If you are prompted to sign in, then enter the sign in details to create the connection. Create the connection in this article lists the steps.

    Note

    In this example, the logic app runs when a file in the folder you choose is updated. To see the results of this trigger, add another action that sends you an email. For example, add the Office 365 Outlook Send an email action that emails you when a file is updated.

  3. Select the Edit button and set the Frequency and Interval values. For example, if you want the trigger to poll every 15 minutes, then set the Frequency to Minute, and set the Interval to 15.

  4. Save your changes (top left corner of the toolbar). Your logic app is saved and may be automatically enabled.

Use an action

An action is an operation carried out by the workflow defined in a logic app. Learn more about actions.

  1. Select the plus sign. You see several choices: Add an action, Add a condition, or one of the More options.

  2. Choose Add an action.

  3. In the text box, type “onedrive” to get a list of all the available actions.

  4. In our example, choose OneDrive - Create file. If a connection already exists, then select the Folder Path to put the file, enter the File Name, and choose the File Content you want:

    If you are prompted for the connection information, then enter the details to create the connection. Create the connection in this article describes these properties.

    Note

    In this example, we create a new file in a OneDrive folder. You can use output from another trigger to create the OneDrive file. For example, add the Office 365 Outlook When a new email arrives trigger. Then add the OneDrive Create file action that uses the Attachments and Content-Type fields within a ForEach to create the new file in OneDrive.

  5. Save your changes (top left corner of the toolbar). Your logic app is saved and may be automatically enabled.

Connector-specific details

View any triggers and actions defined in the swagger, and also see any limits in the connector details.

More connectors

Go back to the APIs list.