One drive

Learn how to use One drive with Composio

Overview

SLUG: ONE_DRIVE

Description

OneDrive is Microsoft’s cloud storage solution enabling users to store, sync, and share files across devices, offering offline access, real-time collaboration, and enterprise-grade security

Authentication Details

client_id
stringRequired
client_secret
stringRequired
oauth_redirect_uri
stringDefaults to https://backend.composio.dev/api/v1/auth-apps/add
scopes
stringDefaults to Files.ReadWrite.All,Sites.Read.All,offline_access
bearer_token
string

Connecting to One drive

Create an auth config

Use the dashboard to create an auth config for the One drive toolkit. This allows you to connect multiple One drive accounts to Composio for agents to use.

1

Select App

Navigate to [One drive](https://platform.composio.dev/marketplace/One drive).

2

Configure Auth Config Settings

Select among the supported auth schemes of and configure them here.

3

Create and Get auth config ID

Click “Create One drive Auth Config”. After creation, copy the displayed ID starting with ac_. This is your auth config ID. This is not a sensitive ID — you can save it in environment variables or a database. This ID will be used to create connections to the toolkit for a given user.

Connect Your Account

Using OAuth2

1from composio import Composio
2
3# Replace these with your actual values
4one_drive_auth_config_id = "ac_YOUR_ONE_DRIVE_CONFIG_ID" # Auth config ID created above
5user_id = "0000-0000-0000" # UUID from database/application
6
7composio = Composio()
8
9
10def authenticate_toolkit(user_id: str, auth_config_id: str):
11 connection_request = composio.connected_accounts.initiate(
12 user_id=user_id,
13 auth_config_id=auth_config_id,
14 )
15
16 print(
17 f"Visit this URL to authenticate One drive: {connection_request.redirect_url}"
18 )
19
20 # This will wait for the auth flow to be completed
21 connection_request.wait_for_connection(timeout=15)
22 return connection_request.id
23
24
25connection_id = authenticate_toolkit(user_id, one_drive_auth_config_id)
26
27# You can also verify the connection status using:
28connected_account = composio.connected_accounts.get(connection_id)
29print(f"Connected account: {connected_account}")

Tools

Executing tools

To prototype you can execute some tools to see the responses and working on the [One drive toolkit’s playground](https://app.composio.dev/app/One drive)

Python
1from composio import Composio
2from openai import OpenAI
3import json
4
5openai = OpenAI()
6composio = Composio()
7
8# User ID must be a valid UUID format
9user_id = "0000-0000-0000" # Replace with actual user UUID from your database
10
11tools = composio.tools.get(user_id=user_id, toolkits=["ONE_DRIVE"])
12
13print("[!] Tools:")
14print(json.dumps(tools))
15
16def invoke_llm(task = "What can you do?"):
17 completion = openai.chat.completions.create(
18 model="gpt-4o",
19 messages=[
20 {
21 "role": "user",
22 "content": task, # Your task here!
23 },
24 ],
25 tools=tools,
26 )
27
28 # Handle Result from tool call
29 result = composio.provider.handle_tool_calls(user_id=user_id, response=completion)
30 print(f"[!] Completion: {completion}")
31 print(f"[!] Tool call result: {result}")
32
33invoke_llm()

Tool List

Tool Name: Copy Item

Description

Tool to copy a driveitem (file or folder) to a new location asynchronously. use when you need to duplicate an item, optionally renaming it or specifying a different parent folder. the operation is asynchronous; the response provides a url to monitor the copy progress.

Action Parameters

@microsoft.graph.conflictBehavior
stringDefaults to fail
children_only
boolean
drive_id
string
group_id
string
include_all_version_history
boolean
item_id
stringRequired
name
string
parent_reference
object
site_id
string
user_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Delete Item

Description

Tool to delete a driveitem (file or folder) by its unique id from the authenticated user's onedrive. use when you need to remove an item from onedrive. this action moves the item to the recycle bin, not permanently deleting it.

Action Parameters

if_match
string
item_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Drive

Description

Retrieves the properties and relationships of a drive resource by its unique id. use this action when you need to get details about a specific onedrive, user's onedrive, group's document library, or a site's document library.

Action Parameters

drive_id
stringRequired
select_fields
array

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Item Metadata

Description

Retrieves the metadata of a driveitem by its unique id. use this tool to get information about a specific file or folder in onedrive when you have its id. if a `drive id` is not provided, it defaults to the user's main drive.

Action Parameters

drive_id
string
expand_relations
array
item_id
stringRequired
select_fields
array

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Item Permissions

Description

Retrieves the permissions of a driveitem by its unique id or path within a specific drive. use when you need to check who has access to a file or folder and what level of access they have.

Action Parameters

drive_id
string
group_id
string
item_id
stringRequired
item_path
string
select
string
site_id
string
user_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Item Thumbnails

Description

Tool to retrieve the thumbnails associated with a driveitem. use when you need to display visual previews of files.

Action Parameters

drive_id
string
group_id
string
item_id
stringRequired
original_orientation
boolean
select
string
site_id
string
user_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Item Versions

Description

Tool to retrieve the version history of a driveitem by its unique id. use when you need to access or list previous versions of a file.

Action Parameters

drive_id
string
group_id
string
item_id
stringRequired
site_id
string
user_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Drive Quota

Description

Tool to retrieve the quota information for the authenticated user's onedrive. use this action to check the storage space details like total, used, and remaining space on the user's onedrive.

Action Parameters

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Recent Items

Description

Retrieves a list of items that have been recently used by the authenticated user. this tool is useful when you need to access or display files and folders that the user has interacted with recently across their onedrive and accessible shared drives.

Action Parameters

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Shared Items

Description

Tool to retrieve a list of items that have been shared with the authenticated user. use this action to get details of files and folders shared with the current user.

Action Parameters

allow_external
boolean

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get SharePoint List Items

Description

Tool to get the items (list items) within a specific sharepoint list on a site. use when you need to retrieve data from a sharepoint list.

Action Parameters

expand
string
filter
string
list_id
stringRequired
select
string
site_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Site Details

Description

Retrieves metadata for a specific sharepoint site by its id. use this action when you need to get details like display name, web url, and creation/modification dates for a known sharepoint site.

Action Parameters

site_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get SharePoint Site Page Content

Description

Gets the content of a modern sharepoint site page. use when you need to retrieve the details and content of a specific page within a sharepoint site.

Action Parameters

expand
string
page_id
stringRequired
site_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Invite User to Drive Item

Description

Tool to invite users or grant permissions to a specific item in a onedrive drive. use when you need to share a file or folder with other users and define their access level (e.g., read or write).

Action Parameters

drive_id
string
expiration_date_time
string
group_id
string
item_id
stringRequired
message
string
password
string
recipients
arrayRequired
require_sign_in
boolean
retain_inherited_permissions
booleanDefaults to True
roles
arrayRequired
send_invitation
boolean
site_id
string
user_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Drives

Description

Tool to retrieve a list of drive resources available to the authenticated user, or for a specific user, group, or site. use when you need to find out what drives are accessible.

Action Parameters

expand
string
group_id
string
orderby
string
select
string
site_id
string
skip_token
string
top
integer
user_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Drive Item Activities

Description

Tool to list recent activities for a specific item in a onedrive drive. use when you need to track changes or actions performed on a file or folder.

Action Parameters

$filter
string
$orderby
string
$skip
integer
$top
integer
drive_id
stringRequired
item_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Root Drive Changes

Description

Tool to list changes in the root of the user's primary drive using a delta token. use when you need to track file and folder modifications, additions, or deletions in the main onedrive directory.

Action Parameters

token
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List SharePoint List Items Delta

Description

Tool to track changes to items in a sharepoint list using a delta query. use when you need to get newly created, updated, or deleted list items without performing a full read of the entire item collection.

Action Parameters

expand
string
list_id
stringRequired
select
string
site_id
stringRequired
token
string
top
integer

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Site Columns

Description

Tool to list all column definitions for a sharepoint site. use this when you need to retrieve the schema or structure of columns within a specific sharepoint site.

Action Parameters

expand
string
filter
string
orderby
string
select
string
site_id
stringRequired
skip
integer
top
integer

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Site Drive Items Delta

Description

Tool to track changes to driveitems in the default document library of a sharepoint site. use when you need to get a list of items that have been added, modified, or deleted since a previous state or to get an initial enumeration of all items.

Action Parameters

site_id
stringRequired
token
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Site Lists

Description

Tool to list all lists under a specific sharepoint site. use when you need to enumerate lists within a known site.

Action Parameters

expand
string
filter
string
orderby
string
select
string
site_id
stringRequired
skip
integer
top
integer

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Site Subsites

Description

Tool to list all subsites of a sharepoint site. use when you need to retrieve a collection of subsites for a given parent site.

Action Parameters

site_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Subscriptions

Description

Tool to list the current subscriptions for the authenticated user or app. use this to retrieve details of existing webhook subscriptions.

Action Parameters

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Move Item

Description

Tool to move a file or folder to a new parent folder in onedrive. use when you need to reorganize your files or folders by changing their location. you can optionally rename the item during the move.

Action Parameters

driveId
string
itemId
stringRequired
name
string
parentReference
objectRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Preview Drive Item

Description

Generates or retrieves a short-lived embeddable url for a preview of a specific item. use when you need to display a temporary preview of a file.

Action Parameters

drive_id
string
group_id
string
item_id
stringRequired
page
string
share_id
string
site_id
string
user_id
string
zoom
number

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Search Items

Description

Searches for driveitems in onedrive that match the specified query. use this to find files or folders based on keywords.

Action Parameters

drive_id
string
orderby
string
q
stringRequired
search_scope
stringDefaults to root
select
string
skip_token
string
top
integer

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Update Drive Item Metadata

Description

Tool to update the metadata of a specific item (file or folder) in onedrive. use this to rename items, change descriptions, or move items to a new parent folder.

Action Parameters

additional_properties
object
description
string
drive_id
string
group_id
string
item_id
stringRequired
name
string
parent_reference_drive_id
string
parent_reference_id
string
site_id
string
user_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Download a file

Description

Downloads a file from a user's onedrive using its item id, which must refer to a file and not a folder.

Action Parameters

file_name
stringRequired
item_id
stringRequired
user_id
stringDefaults to me

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create folder

Description

Creates a new folder in the user's onedrive, automatically renaming on conflict, optionally within a specified parent folder (by id or full path from root) which, if not the root, must exist and be accessible.

Action Parameters

name
stringRequired
parent_folder
stringDefaults to /
user_id
stringDefaults to me

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create a new text file

Description

Creates a new text file with specified content in a onedrive folder, using either the folder's unique id or its absolute path (paths are automatically resolved to ids); note that onedrive may rename or create a new version if the filename already exists.

Action Parameters

content
stringRequired
folder
stringDefaults to /
name
stringRequired
user_id
stringDefaults to me

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Find Item

Description

Non-recursively finds an item (file or folder) in a specified onedrive folder; if `folder` is provided as a path, it must actually exist.

Action Parameters

folder
stringDefaults to /
include_metadata
boolean
name
stringRequired
user_id
stringDefaults to me

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Find Folder

Description

Finds folders by name within an accessible parent folder in onedrive, or lists all its direct child folders if no name is specified.

Action Parameters

folder
stringDefaults to /
name
string
user_id
stringDefaults to me

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List OneDrive items

Description

Retrieves all files and folders as `driveitem` resources from the root of a specified user's onedrive, automatically handling pagination.

Action Parameters

select
array
top
integerDefaults to 50
user_id
stringDefaults to me

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Upload file

Description

Uploads a file to a specified onedrive folder, automatically renaming on conflict and supporting large files via chunking.

Action Parameters

file
objectRequired
folder
stringDefaults to /
user_id
stringDefaults to me

Action Response

data
objectRequired
error
string
successful
booleanRequired