Integrate with OneDrive

Upload files to Drive and create new folders straight from the Next Matter workflow.

Before you begin

  • Make sure you first connect OneDrive in your Next Matter portal.

In your Next Matter portal, go to Company > Integrations, and click Connect for Microsoft OneDrive.

  • Get your OneDrive drive ID. You'll need it in the step configuration. To get the ID:
  1. Sign in to https://developer.microsoft.com/graph/graph-explorer.
  2. Select GET as the method, and provide the following URL: https://graph.microsoft.com/v1.0/sites/users/ID_OR_USER_PRINCIPAL_NAME/drive
Alternative endpoints
GET /groups/{groupId}/drives //To fetch the drives within a group  
GET /sites/{siteId}/drives //To fetch drives for a particular site 
GET /me/drives //To list the current user's drive

For information on how to find site ID, see Create a list in Sharepoint.

  1. View the JSON response for the value of the id parameter.
  • It might also happen that a placeholder can be replaced by a data reference of the data provided in one of the previous steps. That's why it's a good idea to learn more about Data references.

🚧

Good to know: Check out our ready-made templates available when you add a step and select Templates > 3rd party templates. You can use the templates to create a set of pre-configured steps.
Need a specific template? Click the Contact us button in the top right of the page and let us know.

Upload a file to OneDrive

  1. In your Next Matter workflow, click +Add step and select Integration > Custom integration.
  2. Click Settings to configure the step.
  3. Select Microsoft OneDrive in Preconfigured integration.
  4. Enter the following details:
    • Method: PUT
    • URL: https://graph.microsoft.com/v1.0/drives/DRIVE_ID/items/PARENT_ID:/FILE_NAME:/content

      πŸ“˜

      The PARENT_ID is the name of the parent (folder) directory that the file will be inserted to.

    • Body type: Binary
    • In the Body enter the data reference to the file you want to upload.
  5. Save your changes.

Create a new folder in OneDrive

  1. In your Next Matter , click +Add step and select Integration > Custom integration.

  2. Click Settings to configure the step.

  3. Select Microsoft OneDrive in Preconfigured integration.

  4. Enter the following details:

    • Method: PUT
    • URL: https://graph.microsoft.com/v1.0/drives/DRIVE_ID/items/PARENT_FOLDER_ID/children
      You can find the info on how to find the DRIVE_ID in the Before you begin section. The PARENT_FOLDER_ID is the name of the parent folder. It might also be root.
    • Headers: Content-Type: application/json
    • In the Body enter the name of the folder to create. For example:
    {
        "name": "FOLDER_NAME",//replace the placeholder with the name of your folder
        "folder": {}
    }
    
  5. Add a folder ID variable with the value of $.id.

  6. Save your changes.

Copy a file from one folder to the next

  1. In your Next Matter workflow, click +Add step and select Integration > Custom integration.

  2. Click Settings to configure the step.

  3. Select Microsoft OneDrive in Preconfigured integration.

  4. Enter the following details:

    • Method: POST
    • URL: https://graph.microsoft.com/v1.0/me/drive/items/SOURCE_FOLDER_NAME/FILE_NAME:/copy
    • Headers: Content-Type: application/json
    • In the Body enter the name of the folder to create. For example:
{
  "parentReference": {
    "path": "drive/root:/DESTINATION_FOLDER_ID"/ you can find the ID by using Search File or Folder in Microsoft
  },
  "name": "NEW_FILE_NAME"//enter a new name for the copied file
}
  1. Save your changes.