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 Prismatic's OAuth 2.0 callback URL - https://oauth2.prismatic.io/callback - as a Redirect URI for US based integrations.

  • For integrations outside the US refer to this guide to find your region's Callback URL.

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 within Prismatic.

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 "OneDrive", and then "Delegated permissions". You should select all permissions that are required for your desired integration.

Now, configure the OAuth 2.0 connection in Prismatic. 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.

InputDefaultNotes
Authorize URL
string
/ Required
authorizeUrl
https://login.microsoftonline.com/common/oauth2/v2.0/authorize
The OAuth 2.0 Authorization URL for Microsoft One Drive
Client ID
string
/ Required
clientId
Generate this value when you create your Active Directory App
Client Secret
password
/ Required
clientSecret
Generate this value when you create your Active Directory App
Scopes
string
Hidden Field
scopes
https://graph.microsoft.com/Files.Read https://graph.microsoft.com/Files.ReadWrite https://graph.microsoft.com/Sites.ReadWrite.All offline_access
Microsoft One Drive permission scopes are set on the OAuth application
Token URL
string
/ Required
tokenUrl
https://login.microsoftonline.com/common/oauth2/v2.0/token
The OAuth 2.0 Token URL for Microsoft One Drive

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
connection
/ Required
connection
Supply the desired connection for Microsoft One Drive
 
Directory
string
/ Required
dir
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

InputNotes
Connection
connection
/ Required
oneDriveConnection
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
string
/ Required
dir
Provide the directory of the file. If you want to access the root, just supply a forward slash.
/myFolder/examples
Connection
connection
/ Required
oneDriveConnection
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

InputDefaultNotesExample
Allow Duplicates
boolean
allowDuplicates
Enable to allow more than one subscription per endpoint
 
Change Type
string
/ Required
changeType
updated
The type of changes that should generate notifications for this subscription. OneDrive only supports updated.
updated
Client State
string
clientState
An optional string value that is passed back in the notification message for this subscription.
client-specific string
Expiration Date Time
string
/ Required
expirationDateTime
The date and time when the subscription will expire if not updated or renewed.
2018-01-01T11:23:00.000Z
Notification URL
string
/ Required
notificationUrl
The URL that notifications should be delivered to, if required for the specified notificationType.
https://contoso.azurewebsites.net/api/webhook-receiver
Connection
connection
/ Required
oneDriveConnection
 
Supply the desired connection for Microsoft One Drive
 
Resource
string
/ Required
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.prismatic.io/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
connection
/ Required
oneDriveConnection
Supply the desired connection for Microsoft One Drive
 
Subscription Id
string
/ Required
subscriptionId
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

InputNotes
Connection
connection
/ Required
oneDriveConnection
Supply the desired connection for Microsoft One Drive

Delete File

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

InputNotesExample
Connection
connection
/ Required
connection
Supply the desired connection for Microsoft One Drive
 
Drive
string
/ Required
driveId
Provide an identifier for the drive. This value should be an Id.
084903745
Item Id
string
/ Required
itemId
Provide an Id for for the item.
084903745

Download File

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

InputNotesExample
Connection
connection
/ Required
connection
Supply the desired connection for Microsoft One Drive
 
File Location
string
/ Required
fileLocation
Provide a leading slash followed by the location of your file within the current user's drive.
/folder1/myExampleFile.csv
Timeout
string
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
connection
/ Required
connection
Supply the desired connection for Microsoft One Drive
 
Drive
string
/ Required
driveId
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
connection
/ Required
connection
Supply the desired connection for Microsoft One Drive
 
Drive
string
/ Required
driveId
Provide an identifier for the drive. This value should be an Id.
084903745
Item Id
string
/ Required
itemId
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
connection
/ Required
connection
Supply the desired connection for Microsoft One Drive
 
File Location
string
/ Required
dir
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
connection
/ Required
connection
Supply the desired connection for Microsoft One Drive
 
Site
string
/ Required
siteId
Provide an Id for the site.
084903745

List Changes

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

InputDefaultNotesExample
$expand Parameter
string
$expand
Retrieves related resources. https://learn.microsoft.com/en-us/graph/query-parameters?tabs=http#expand-parameter
members
$select Parameter
string
$select
Filters properties (columns). https://learn.microsoft.com/en-us/graph/query-parameters?tabs=http#select-parameter
givenName,surname
$top Parameter
string
$top
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
string
/ Required
deltaURL
/drives/{drive-id}/root/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
connection
/ Required
oneDriveConnection
 
Supply the desired connection for Microsoft One Drive
 

List Children

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

InputNotesExample
Connection
connection
/ Required
connection
Supply the desired connection for Microsoft One Drive
 
Drive
string
/ Required
driveId
Provide an identifier for the drive. This value should be an Id.
084903745
Item Id
string
/ Required
itemId
Provide an Id for for the item.
084903745
Page Limit
string
pageLimit
Enter a number amount for the page size.
100
Page Token
string
pageToken
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
connection
/ Required
connection
Supply the desired connection for Microsoft One Drive
 
Group
string
/ Required
groupId
Provide an Id for the group.
084903745
Page Limit
string
pageLimit
Enter a number amount for the page size.
100
Page Token
string
pageToken
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
connection
/ Required
connection
Supply the desired connection for Microsoft One Drive
 
Page Limit
string
pageLimit
Enter a number amount for the page size.
100
Page Token
string
pageToken
Enter the token for the desired page.
X%2744537079ghv
Site
string
/ Required
siteId
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
connection
/ Required
connection
Supply the desired connection for Microsoft One Drive
 
Page Limit
string
pageLimit
Enter a number amount for the page size.
100
Page Token
string
pageToken
Enter the token for the desired page.
X%2744537079ghv
User
string
/ Required
userId
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
connection
/ Required
connection
Supply the desired connection for Microsoft One Drive
 
Page Limit
string
pageLimit
Enter a number amount for the page size.
100
Page Token
string
pageToken
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
connection
/ Required
connection
Supply the desired connection for Microsoft One Drive
 
Page Limit
string
pageLimit
Enter a number amount for the page size.
100
Page Token
string
pageToken
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
connection
/ Required
connection
Supply the desired connection for Microsoft One Drive
 
Directory
string
/ Required
dir
Provide the directory of the file. If you want to access the root, just supply a forward slash.
/myFolder/examples
Page Limit
string
pageLimit
Enter a number amount for the page size.
100
Page Token
string
pageToken
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
connection
/ Required
connection
Supply the desired connection for Microsoft One Drive
 
Page Limit
string
pageLimit
Enter a number amount for the page size.
100
Page Token
string
pageToken
Enter the token for the desired page.
X%2744537079ghv

List Shared

List shared items in SharePoint or OneDrive | key: listShared

InputNotes
Connection
connection
/ Required
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
connection
/ Required
connection
Supply the desired connection for Microsoft One Drive
 
Page Limit
string
pageLimit
Enter a number amount for the page size.
100
Page Token
string
pageToken
Enter the token for the desired page.
X%2744537079ghv

List Subscriptions

List all available Subscriptions | key: listSubscriptions

InputDefaultNotes
Connection
connection
/ Required
oneDriveConnection
 
Supply the desired connection for Microsoft One Drive
Show Instance Subscriptions
boolean
showInstanceSubscriptions
Show only subscriptions for this Instance's Subscriptions

{
"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.prismatic.io/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
connection
/ Required
connection
Supply the desired connection for Microsoft One Drive
 
Current Location
string
/ Required
dir
Provide a leading slash, followed by the location and name of the file
/myFile.txt
New File Name
string
/ Required
fileName
Provide a new name for the given file.
myNewFile.txt
New Location
string
/ Required
path
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

InputDefaultNotesExample
Connection
connection
/ Required
connection
 
Supply the desired connection for Microsoft One Drive
 
Data
string
data
The HTTP body payload to send to the URL.
{"exampleKey": "Example Data"}
Debug Request
boolean
debugRequest
false
Enabling this flag will log out the current request.
 
File Data
string
Key Value List
fileData
File Data to be sent as a multipart form upload.
[{key: "example.txt", value: "My File Contents"}]
File Data File Names
string
Key Value List
fileDataFileNames
File names to apply to the file data inputs. Keys must match the file data keys above.
 
Form Data
string
Key Value List
formData
The Form Data to be sent as a multipart form upload.
[{"key": "Example Key", "value": new Buffer("Hello World")}]
Header
string
Key Value List
headers
A list of headers to send with the request.
User-Agent: curl/7.64.1
Max Retry Count
string
maxRetries
0
The maximum number of retries to attempt.
 
Method
string
/ Required
method
The HTTP method to use.
 
Query Parameter
string
Key Value List
queryParams
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
string
/ Required
responseType
json
The type of data you expect in the response. You can request json, text, or binary data.
 
Retry On All Errors
boolean
retryAllErrors
false
If true, retries on all erroneous responses regardless of type.
 
Retry Delay (ms)
string
retryDelayMS
0
The delay in milliseconds between retries.
 
Timeout
string
timeout
The maximum time that a client will await a response to its request
2000
URL
string
/ Required
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
boolean
useExponentialBackoff
false
Specifies whether to use a pre-defined exponential backoff strategy for retries.
 

Search Drive

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

InputNotesExample
Connection
connection
/ Required
connection
Supply the desired connection for Microsoft One Drive
 
Search
string
/ Required
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
connection
/ Required
connection
Supply the desired connection for Microsoft One Drive
 
User
string
/ Required
userId
Provide a user id.
87d349ed-44d7-43e1-9a83-5f2406dee5bd

Update File

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

InputNotesExample
Connection
connection
/ Required
connection
Supply the desired connection for Microsoft One Drive
 
File Location
string
/ Required
dir
Provide a leading slash, followed by the location and name of the file.
/folder1/myFile.txt
New File Name
string
fileName
Provide a new name for the given file.
exampleFile
New File Path
string
path
Enter a path to the desired sharepoint resource. You do not need to include the root directory.
/myfiles/myfile.txt
Optional Values
string
Key Value List
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
connection
/ Required
connection
Supply the desired connection for Microsoft One Drive
 
File Data
data
/ Required
fileData
Provide a value for the file.
 
File Location
string
/ Required
fileName
Provide a leading slash, followed by the location and name of the new file.
/folder1/myNewFile.csv
Timeout
string
timeout
The amount of time the client will await a response.
3000