Skip to content
Scalekit Docs
Talk to an Engineer Dashboard

Connect AI agents to OneDrive

Scalekit connector
Open markdown

The OneDrive connector lets your AI agent act in each user's OneDrive account. Each user signs in to OneDrive once, and Scalekit stores and refreshes their tokens, so your agent never handles credentials. It comes with 46 tools.

Tools
46
What they doRead · write · destructive
26 · 17 · 326 read17 write3 destructive
Users sign in with
OAuth app
Scalekit's or your own

Setup

  1. Install the SDK

    Terminal window
    npm install @scalekit-sdk/node dotenv
  2. Set your credentials

    Add your Scalekit credentials to your .env file. Find values in app.scalekit.com > Developers > API Credentials.

    .env
    SCALEKIT_ENVIRONMENT_URL=<your-environment-url>
    SCALEKIT_CLIENT_ID=<your-client-id>
    SCALEKIT_CLIENT_SECRET=<your-client-secret>
  3. Create the OneDrive connection

    In AgentKit > Connections, create an OneDrive connection. The name you give it is the connection_name your code passes. See Configure connections.

    Scalekit credentials are available for OneDrive, so you don't need to register an OAuth app. To show your own app on the consent screen, use your own credentials instead.

    Use your own OAuth app

    Register your Scalekit environment with the OneDrive connector so Scalekit handles the authentication flow and token lifecycle for you. The connection name you create will be used to identify and invoke the connection programmatically. Then complete the configuration in your application as follows:

    1. Set up auth redirects

      • In Scalekit dashboard, go to AgentKit > Connections > Create Connection. Find OneDrive and click Create. Copy the redirect URI. It will look like https://<SCALEKIT_ENVIRONMENT_URL>/sso/v1/oauth/<CONNECTION_ID>/callback.

        Copy redirect URI from Scalekit dashboard

      • Sign into portal.azure.com and go to Azure Active Directory → App registrations → New registration.

      • Enter a name for your app.

      • Under Supported account types, select Accounts in any organizational directory (Any Azure AD directory - Multitenant) and personal Microsoft accounts.

      • Under Redirect URI, select Web and paste the redirect URI from step 1. Click Register.

        Register an application in Azure portal

    2. Get your client credentials

      • Go to Certificates & secrets → New client secret, set an expiry, and click Add. Copy the Value immediately.

      • From the Overview page, copy the Application (client) ID.

    3. Add credentials in Scalekit

      • In Scalekit dashboard, go to AgentKit > Connections and open the connection you created.

      • Enter your credentials:

        Add credentials in Scalekit dashboard

      • Click Save.

  4. Authorize a user and make your first call

    quickstart.mts
    import { ScalekitClient } from '@scalekit-sdk/node'
    import 'dotenv/config'
    import { createInterface } from 'node:readline/promises'
    const scalekit = new ScalekitClient(
    process.env.SCALEKIT_ENVIRONMENT_URL,
    process.env.SCALEKIT_CLIENT_ID,
    process.env.SCALEKIT_CLIENT_SECRET,
    )
    const actions = scalekit.actions
    const connector = 'onedrive'
    const identifier = 'user_123'
    // Generate an authorization link for the user
    const { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })
    console.log('Authorize OneDrive:', link)
    const rl = createInterface({ input: process.stdin, output: process.stdout })
    await rl.question('Press Enter after authorizing...')
    rl.close()
    // Make your first call
    const result = await actions.executeTool({
    connector,
    identifier,
    toolName: 'onedrive_get_drive',
    toolInput: {},
    })
    console.log(result)
    Terminal window
    npx tsx quickstart.mts

    Each user signs in once. See Authorize a user for the full flow and statuses.

Tools

Pass the exact name to execute_tool
Try in PlaygroundRequest a tool
  • onedrive_download_fileDownload the binary content of a OneDrive file by its item ID.Read-only

    Download Drive File

    Download the binary content of a OneDrive file by its item ID. The response is the raw file bytes (not JSON). For text files this will be readable text; for binary files (images, Office documents) it will be binary data. Use the item ID from get or list operations.

    Inputs

    item_idstringrequired
    The unique ID of the OneDrive file to download. Obtain item IDs from list drive items or search drive items operations.
  • onedrive_download_file_in_driveDownload the binary content of a file in a specific drive (e.g.Read-only

    Download File in Drive

    Download the binary content of a file in a specific drive (e.g. a SharePoint document library or another user's drive) by drive ID and item ID. To download from the signed-in user's personal OneDrive, use onedrive_download_file instead.

    Inputs

    drive_idstringrequired
    The unique ID of the drive containing the file
    item_idstringrequired
    The unique ID of the file to download
  • onedrive_get_driveRetrieve the properties of the signed-in user's default OneDrive drive, including storage quota, owner information, and drive type (personal, business, or SharePoint document library).Read-only

    Get OneDrive

    Retrieve the properties of the signed-in user's default OneDrive drive, including storage quota, owner information, and drive type (personal, business, or SharePoint document library).

    Inputs

    This tool takes no inputs.

  • onedrive_get_drive_itemRetrieve metadata for a file or folder in the signed-in user's personal OneDrive by item ID.Read-only

    Get Drive Item

    Retrieve metadata for a file or folder in the signed-in user's personal OneDrive by item ID. Returns name, size, creation date, last modified date, MIME type, and download URL. To get an item from a specific drive by drive ID (e.g. a SharePoint document library), use onedrive_get_item_in_drive instead.

    Inputs

    item_idstringrequired
    The unique ID of the OneDrive file or folder to retrieve. Obtain item IDs from list or search operations.
  • onedrive_get_item_analyticsGet view and access analytics for a OneDrive file or folder, aggregated over the allTime and lastSevenDays time periods.Read-only

    Get Drive Item Analytics

    Get view and access analytics for a OneDrive file or folder, aggregated over the allTime and lastSevenDays time periods. Returns metrics such as view count and unique viewer count, useful for understanding how popular or actively used an item is.

    Inputs

    item_idstringrequired
    The unique ID of the OneDrive file or folder to get analytics for.
  • onedrive_get_item_by_pathRetrieve metadata for a file or folder in the signed-in user's personal OneDrive using its human-readable folder path instead of an item ID.Read-only

    Get Drive Item by Path

    Retrieve metadata for a file or folder in the signed-in user's personal OneDrive using its human-readable folder path instead of an item ID. Useful when the caller knows a path like 'Documents/Reports/Q1.xlsx' but not the underlying item ID.

    Inputs

    item_pathstringrequired
    The path of the file or folder relative to the root of OneDrive, without a leading slash. Example: 'Documents/Reports/Q1.xlsx'.
  • onedrive_get_item_in_driveRetrieve metadata for a specific file or folder in a drive by drive ID and item ID.Read-only

    Get Item in Drive

    Retrieve metadata for a specific file or folder in a drive by drive ID and item ID. Works across any drive accessible to the signed-in user, including SharePoint document libraries and Teams drives. Returns name, size, creation date, last modified date, MIME type, and download URL. To get an item from the signed-in user's personal OneDrive, use onedrive_get_drive_item instead.

    Inputs

    drive_idstringrequired
    The unique ID of the drive containing the item. Obtain drive IDs from onedrive_list_drives or sharepoint_list_drives.
    item_idstringrequired
    The unique ID of the file or folder to retrieve. Obtain item IDs from list or search operations.
  • onedrive_get_permissionRetrieve the full details of a single sharing permission on a OneDrive file or folder by its permission ID.Read-only

    Get Drive Item Permission

    Retrieve the full details of a single sharing permission on a OneDrive file or folder by its permission ID. Use onedrive_list_permissions first to find the permission ID.

    Inputs

    item_idstringrequired
    The unique ID of the OneDrive file or folder that has the permission
    permission_idstringrequired
    The unique ID of the permission to retrieve

Workflows

Proxy API call
const result = await actions.request({
connectionName: 'onedrive',
identifier: 'user_123',
path: '/v1.0/me/drive',
method: 'GET',
});
console.log(result);
Execute a tool
const result = await actions.executeTool({
connector: 'onedrive',
identifier: 'user_123',
toolName: 'onedrive_list_drive_items',
toolInput: { item_id: 'root' },
});
console.log(result);