Skip to main content

Microsoft OneDrive Component

Interact with files and drives inside your Microsoft OneDrive tenant

Component key: ms-onedrive

Description

Microsoft One Drive is a file hosting service that allows you to collaborate and share files with your team members.

Connections

OAuth 2.0

Once you have an instance of Microsoft OneDrive licensed to your account, you will need to create and configure a new "App Registration" within your Azure Active Directory tenant. When creating the application you will be prompted to select the 'Supported account types'. Under this section, be sure to select 'Accounts in any organizational directory (Any Azure AD directory - Multitenant)'.

You will need to go to "Platforms" and add the "Web" platform. In that section you should add the OAuth 2.0 callback URL - https://oauth2.prismatic.io/callback - as a Redirect URI.

Next, go to "Certificates & Secrets" for the app and add a new Client Secret. Note this value as you will need to supply it to the connection.

You will also need the Application (client) ID from the "Overview" page.

The last step of configuring the "App Registration" is assigning "App Permissions". Click "Add Permission", click on the square labeled "Microsoft Graph", and then "Delegated permissions". You should select all permissions that are required for your desired integration.

  • Additionally, ensure the offline_access scope is included in your app registration. It is essential to maintain your OAuth connection and receive refresh tokens. Without it, users will need to re-authenticate every hour.

Now, configure the OAuth 2.0 connection. Add an MS OneDrive OAuth 2.0 connection config variable:

  • Use the Application (client) ID value for the Client ID field.
  • Use the Client Secret for the same named field.
  • If you didn't select Multitenant when creating the Azure application, you will need to replace the Authorize URL and Token URL with ones specific to your tenant.

Save your integration and you should be able to authenticate a user through MS OneDrive with OAuth 2.0.

InputNotesExample
Authorize URL

The OAuth 2.0 Authorization URL for Microsoft One Drive

https://login.microsoftonline.com/common/oauth2/v2.0/authorize
Client ID

Generate this value when you create your Active Directory App

Client Secret

Generate this value when you create your Active Directory App

Scopes

Microsoft One Drive permission scopes are set on the OAuth application

https://graph.microsoft.com/Files.Read https://graph.microsoft.com/Files.ReadWrite https://graph.microsoft.com/Sites.ReadWrite.All offline_access
Token URL

The OAuth 2.0 Token URL for Microsoft One Drive

https://login.microsoftonline.com/common/oauth2/v2.0/token

Triggers

Webhook

Receive and validate webhook requests from OneDrive for webhooks you configure. | key: webhook


Data Sources

Files in Directory

A picklist of files in a given directory | key: listFilesInDirectory | type: picklist

InputNotesExample
Connection

Supply the desired connection for Microsoft One Drive

Directory

Provide the directory of the file. If you want to access the root, just supply a forward slash.

/myFolder/examples

List Drives from Source

A picklist of drives for an account | key: listDrives | type: picklist

InputNotesExample
Connection

Supply the desired connection for Microsoft One Drive


List Folders from Source

A picklist of folders in a given directory | key: listFolders | type: picklist

InputNotesExample
Directory

Provide the directory of the file. If you want to access the root, just supply a forward slash.

/myFolder/examples
Connection

Supply the desired connection for Microsoft One Drive


List Groups from Source

A picklist of groups for an account | key: listGroups | type: picklist

InputNotesExample
Connection

Supply the desired connection for Microsoft One Drive


List Users from Source

A picklist of users for an account | key: listUsers | type: picklist

InputNotesExample
Connection

Supply the desired connection for Microsoft One Drive


Actions

Create a Subscription

Create a Subscription to notify you of changes to a resource | key: createSubscription

InputNotesExample
Allow Duplicates

Enable to allow more than one subscription per endpoint

false
Change Type

The type of changes that should generate notifications for this subscription. OneDrive only supports updated.

updated
Client State

An optional string value that is passed back in the notification message for this subscription.

client-specific string
Expiration Date Time

The date and time when the subscription will expire if not updated or renewed.

2018-01-01T11:23:00.000Z
Notification URL

The URL that notifications should be delivered to, if required for the specified notificationType.

https://contoso.azurewebsites.net/api/webhook-receiver
Connection

Supply the desired connection for Microsoft One Drive

Resource

The relative path of the subscription within the drive. Read-only.

/me/drive/root

{
"data": {
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#subscriptions/$entity",
"id": "38031b7d-16b1-448a-8e68-68b8aec62315",
"resource": "/me/drive/root",
"applicationId": "0fed8223-8c47-4c71-ba78-92c6f9448725",
"changeType": "updated",
"clientState": "client-specific string",
"notificationUrl": "https://hooks.example.com/trigger/SW5z",
"notificationQueryOptions": null,
"lifecycleNotificationUrl": null,
"expirationDateTime": "2023-07-01T11:23:00Z",
"creatorId": "6219df3c-04d4-4b39-b2a4-ad162a5dcb8f",
"includeResourceData": null,
"latestSupportedTlsVersion": "v1_2",
"encryptionCertificate": null,
"encryptionCertificateId": null,
"notificationUrlAppId": null
}
}

Delete a Subscription

Delete a Subscription by ID | key: deleteSubscription

InputNotesExample
Connection

Supply the desired connection for Microsoft One Drive

Subscription Id

The Id the subscription to delete

48bf81d7-2d37-40a9-b47b-c1d1960d00f87

{
"data": ""
}

Delete all Instanced Subscriptions

Delete all existing subscriptions for this instance | key: deleteSubscriptions

InputNotesExample
Connection

Supply the desired connection for Microsoft One Drive


Delete File

Delete the information and metadata of a file by path | key: deleteFile

InputNotesExample
Connection

Supply the desired connection for Microsoft One Drive

Drive

Provide an identifier for the drive. This value should be an Id.

084903745
Item Id

Provide an Id for for the item.

084903745

Download File

Download a file from the current user's drive | key: downloadFile

InputNotesExample
Connection

Supply the desired connection for Microsoft One Drive

File Location

Provide a leading slash followed by the location of your file within the current user's drive.

/folder1/myExampleFile.csv
Timeout

The amount of time the client will await a response.

3000

Get Drive

Get the information and metadata of a drive | key: getDrive

InputNotesExample
Connection

Supply the desired connection for Microsoft One Drive

Drive

Provide an identifier for the drive. This value should be an Id.

084903745

Get Item

Returns the information and metadata of an existing item | key: getItemById

InputNotesExample
Connection

Supply the desired connection for Microsoft One Drive

Drive

Provide an identifier for the drive. This value should be an Id.

084903745
Item Id

Provide an Id for for the item.

084903745

Get Item by Path

Get the information and metadata of an item with your path in Sharepoint | key: getItem

InputNotesExample
Connection

Supply the desired connection for Microsoft One Drive

File Location

Provide a leading slash, followed by the location and name of your file.

/folder1/myFile.txt

Get Site

Get the information and metadata of a given Site | key: getSite

InputNotesExample
Connection

Supply the desired connection for Microsoft One Drive

Site

Provide an Id for the site.

084903745

List Changes

Track changes in a driveItem and its children over time. | key: listChanges

InputNotesExample
$expand Parameter

Retrieves related resources. https://learn.microsoft.com/en-us/graph/query-parameters?tabs=http#expand-parameter

members
$select Parameter

Filters properties (columns). https://learn.microsoft.com/en-us/graph/query-parameters?tabs=http#select-parameter

givenName,surname
$top Parameter

Sets the page size of results. https://learn.microsoft.com/en-us/graph/query-parameters?tabs=http#top-parameter

5
URL to fetch for delta

The URL to track changes in a driveItem and its children over time. You can also paste here the @odata.nextLink or @odata.deltaLink from a previous response to resume tracking changes.

/drives/{drive-id}/root/delta
Connection

Supply the desired connection for Microsoft One Drive


List Children

Returns all child elements on a given drive item | key: listChildren

InputNotesExample
Connection

Supply the desired connection for Microsoft One Drive

Drive

Provide an identifier for the drive. This value should be an Id.

084903745
Item Id

Provide an Id for for the item.

084903745
Page Limit

Enter a number amount for the page size.

100
Page Token

Enter the token for the desired page.

X%2744537079ghv

List Drives By Group

Returns a list of all drives available to the given group | key: listDrivesByGroup

InputNotesExample
Connection

Supply the desired connection for Microsoft One Drive

Group

Provide an Id for the group.

084903745
Page Limit

Enter a number amount for the page size.

100
Page Token

Enter the token for the desired page.

X%2744537079ghv

List Drives By Site

Returns a list of all drives available to the given site | key: listDrivesBySite

InputNotesExample
Connection

Supply the desired connection for Microsoft One Drive

Page Limit

Enter a number amount for the page size.

100
Page Token

Enter the token for the desired page.

X%2744537079ghv
Site

Provide an Id for the site.

084903745

List Drives By User

Returns a list of all drives available to the given user | key: listDrivesByUser

InputNotesExample
Connection

Supply the desired connection for Microsoft One Drive

Page Limit

Enter a number amount for the page size.

100
Page Token

Enter the token for the desired page.

X%2744537079ghv
User

Provide a user id.

87d349ed-44d7-43e1-9a83-5f2406dee5bd

List Files Shared With Me

Returns all files shared with your account | key: listSharedFiles

InputNotesExample
Connection

Supply the desired connection for Microsoft One Drive

Page Limit

Enter a number amount for the page size.

100
Page Token

Enter the token for the desired page.

X%2744537079ghv

{
"data": {
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(driveItem)",
"value": [
{
"@odata.type": "#microsoft.graph.driveItem",
"createdDateTime": "2021-03-06T19:25:37.131Z",
"id": "EXAMPLE",
"lastModifiedDateTime": "2021-03-06T19:25:37.131Z",
"name": "My Document.docx",
"webUrl": "https://my-endpoint.sharepoint.com/personal/my_friend_email_com/_layouts/Doc.aspx?sourcedoc=%7B7847AF9A-D834-4899-BCFF-B53E6CB3EB8A%7D&file=Document%20-%20Copy.docx&action=default&mobileredirect=true",
"size": 10484,
"createdBy": {
"user": {
"email": "my_friend@email.com",
"displayName": "My Friend"
}
},
"lastModifiedBy": {
"user": {
"email": "my_friend@email.com",
"displayName": "My Friend"
}
},
"file": {
"mimeType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
},
"fileSystemInfo": {
"createdDateTime": "2021-03-06T19:25:37.131Z",
"lastModifiedDateTime": "2021-03-06T19:25:37.131Z"
},
"remoteItem": {
"createdDateTime": "2021-03-06T19:25:37.131Z",
"id": "EXAMPLE",
"lastModifiedDateTime": "2021-03-06T19:25:37.131Z",
"name": "My Document.docx",
"size": 10484,
"webDavUrl": "https://my-endpoint.sharepoint.com/personal/my_friend_email_com/Documents/My%20Document.docx",
"webUrl": "https://my-endpoint.sharepoint.com/personal/my_friend_email_com/_layouts/Doc.aspx?sourcedoc=%7B7847AF9A-D834-4899-BCFF-B53E6CB3EB8A%7D&file=Document%20-%20Copy.docx&action=default&mobileredirect=true",
"createdBy": {
"user": {
"email": "my_friend@email.com",
"displayName": "My Friend"
}
},
"file": {
"mimeType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
},
"fileSystemInfo": {
"createdDateTime": "2021-03-06T19:25:37.131Z",
"lastModifiedDateTime": "2021-03-06T19:25:37.131Z"
},
"lastModifiedBy": {
"user": {
"email": "my_friend@email.com",
"displayName": "My Friend"
}
},
"parentReference": {
"driveId": "EXAMPLE",
"driveType": "business",
"id": "EXAMPLE"
},
"shared": {
"scope": "users",
"sharedDateTime": "2021-03-06T19:25:37.131Z",
"sharedBy": {
"user": {
"email": "my_friend@email.com",
"displayName": "My Friend"
}
}
},
"sharepointIds": {
"listId": "00000000-00000000-00000000-00000000",
"listItemId": "3",
"listItemUniqueId": "00000000-00000000-00000000-00000000",
"siteId": "00000000-00000000-00000000-00000000",
"siteUrl": "https://my-endpoint.sharepoint.com/personal/my_friend_email_com",
"tenantId": "00000000-00000000-00000000-00000000",
"webId": "00000000-00000000-00000000-00000000"
}
}
}
]
}
}

List Groups

Returns a list of all groups the user has access to | key: listGroups

InputNotesExample
Connection

Supply the desired connection for Microsoft One Drive

Page Limit

Enter a number amount for the page size.

100
Page Token

Enter the token for the desired page.

X%2744537079ghv

List Items In Directory

Returns a list of all items in the given directory | key: listDriveItems

InputNotesExample
Connection

Supply the desired connection for Microsoft One Drive

Directory

Provide the directory of the file. If you want to access the root, just supply a forward slash.

/myFolder/examples
Page Limit

Enter a number amount for the page size.

100
Page Token

Enter the token for the desired page.

X%2744537079ghv

List My Drives

Returns a list of all drives available to the current user | key: listDrives

InputNotesExample
Connection

Supply the desired connection for Microsoft One Drive

Page Limit

Enter a number amount for the page size.

100
Page Token

Enter the token for the desired page.

X%2744537079ghv

List Shared

List shared items in SharePoint or OneDrive | key: listShared

InputNotesExample
Connection

Supply the desired connection for Microsoft One Drive


List Sites

Returns a list of all sites available to the current user | key: listSites

InputNotesExample
Connection

Supply the desired connection for Microsoft One Drive

Page Limit

Enter a number amount for the page size.

100
Page Token

Enter the token for the desired page.

X%2744537079ghv

List Subscriptions

List all available Subscriptions | key: listSubscriptions

InputNotesExample
Connection

Supply the desired connection for Microsoft One Drive

Show Instance Subscriptions

Show only subscriptions for this Instance's Subscriptions

true

{
"data": {
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#subscriptions",
"value": [
{
"id": "38031b7d-16b1-448a-8e68-68b8aec6df45",
"resource": "/me/drive/root",
"applicationId": "0fed8223-8c47-4c71-ba78-92c6f9441235",
"changeType": "updated",
"clientState": null,
"notificationUrl": "https://hooks.example.com/trigger/SW5",
"notificationQueryOptions": null,
"lifecycleNotificationUrl": null,
"expirationDateTime": "2023-07-01T11:23:00Z",
"creatorId": "62162f3c-04d4-4b39-b2a4-ad891a5dcb8f",
"includeResourceData": null,
"latestSupportedTlsVersion": "v1_2",
"encryptionCertificate": null,
"encryptionCertificateId": null,
"notificationUrlAppId": null
}
]
}
}

Move File

Move the given file to a new location | key: moveFile

InputNotesExample
Connection

Supply the desired connection for Microsoft One Drive

Current Location

Provide a leading slash, followed by the location and name of the file

/myFile.txt
New File Name

Provide a new name for the given file.

myNewFile.txt
New Location

Provide a leading slash, followed by the new location of the file.

/myfiles/myfile.txt

Raw Request

Send raw HTTP request to Microsoft Onedrive | key: rawRequest

InputNotesExample
Connection

Supply the desired connection for Microsoft One Drive

Data

The HTTP body payload to send to the URL.

{"exampleKey": "Example Data"}
Debug Request

Enabling this flag will log out the current request.

false
File Data

File Data to be sent as a multipart form upload.

[{key: "example.txt", value: "My File Contents"}]
File Data File Names

File names to apply to the file data inputs. Keys must match the file data keys above.

Form Data

The Form Data to be sent as a multipart form upload.

[{"key": "Example Key", "value": new Buffer("Hello World")}]
Header

A list of headers to send with the request.

User-Agent: curl/7.64.1
Max Retry Count

The maximum number of retries to attempt. Specify 0 for no retries.

0
Method

The HTTP method to use.

Query Parameter

A list of query parameters to send with the request. This is the portion at the end of the URL similar to ?key1=value1&key2=value2.

Response Type

The type of data you expect in the response. You can request json, text, or binary data.

json
Retry On All Errors

If true, retries on all erroneous responses regardless of type. This is helpful when retrying after HTTP 429 or other 3xx or 4xx errors. Otherwise, only retries on HTTP 5xx and network errors.

false
Retry Delay (ms)

The delay in milliseconds between retries. This is used when 'Use Exponential Backoff' is disabled.

0
Timeout

The maximum time that a client will await a response to its request

2000
URL

Input the path only (/me/drive), The base URL is already included (https://graph.microsoft.com/v1.0). For example, to connect to https://graph.microsoft.com/v1.0/me/drive, only /me/drive is entered in this field.

/me/drive
Use Exponential Backoff

Specifies whether to use a pre-defined exponential backoff strategy for retries. When enabled, 'Retry Delay (ms)' is ignored.

false

Search Drive

Search the current drive for a string of text | key: searchDrive

InputNotesExample
Connection

Supply the desired connection for Microsoft One Drive

Search

Provide a text to search the current drive with.

myFile

Search Users

Find the information and metadata of an existing user | key: searchUser

InputNotesExample
Connection

Supply the desired connection for Microsoft One Drive

User

Provide a user id.

87d349ed-44d7-43e1-9a83-5f2406dee5bd

Update File

Update the information and metadata of a given file | key: updateFile

InputNotesExample
Connection

Supply the desired connection for Microsoft One Drive

File Location

Provide a leading slash, followed by the location and name of the file.

/folder1/myFile.txt
New File Name

Provide a new name for the given file.

exampleFile
New File Path

Enter a path to the desired sharepoint resource. You do not need to include the root directory.

/myfiles/myfile.txt
Optional Values

Provide optional key-value pairs to be used in the request body.


Upload File

Upload a file to the user's connected drive | key: uploadFile

InputNotesExample
Connection

Supply the desired connection for Microsoft One Drive

File Data

Provide a value for the file.

File Location

Provide a leading slash, followed by the location and name of the new file.

/folder1/myNewFile.csv
Timeout

The amount of time the client will await a response.

3000