# OneDrive on boxd

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

- Page: https://boxd.sh/integrations/one-drive/
- CLI: `run one-drive` (83 commands, 56 marked common)
- SDK: `import { oneDrive } from "@boxd/run"`; every parameter and response type is at `@boxd/run/one-drive`
- Triggers: 9
- Connect: `run auth one-drive` (Sign in with OneDrive), or https://app.boxd.sh/integrations/detail/one_drive
- All integrations: https://boxd.sh/integrations/ (Markdown: https://boxd.sh/integrations/index.md)

## From the shell

```sh
run auth one-drive      # once: prints a link to connect your account
run one-drive           # list its commands
run one-drive get-root
```

Parameters are flags (`--flag value`); object and array parameters take a JSON string. Output is YAML, or JSON with `--json`. Calls use your own connection; `--scope <name>` uses a connection shared with your team.

## From a script

```ts
import { oneDrive } from "@boxd/run";

const result = await oneDrive.getRoot({});
console.log(result);

oneDrive.on("file-created", async (event) => {
  // OneDrive File Created Trigger: runs on this machine, once per event
  console.log(event);
});
```

Run it with `run one-drive.run.ts`. A script that calls `.on()` keeps running as a job and handles each event.

## Commands

Required flags are listed; `run one-drive <command> --help` lists the optional ones. "common" marks what `run one-drive` shows without `--all`.

| Command | SDK method | Required flags | Optional | Description |
|---|---|---|---|---|
| `add-workbook-worksheet` | `oneDrive.addWorkbookWorksheet()` | `--drive-id` `--item-id` | 2 | Adds a new worksheet to an existing Excel workbook in OneDrive or SharePoint |
| `checkin-item` ·common | `oneDrive.checkinItem()` | `--drive-id` `--drive-item-id` | 2 | Check in a checked out driveItem resource, making the version of the document available to others |
| `checkout-item` ·common | `oneDrive.checkoutItem()` | `--drive-id` `--drive-item-id` | 0 | Check out a driveItem to prevent others from editing it and make your changes invisible until checked in |
| `clear-workbook-range` | `oneDrive.clearWorkbookRange()` | `--address` `--drive-id` `--item-id` `--worksheet-id-or-name` | 2 | Clears values, formats, or both from a worksheet range in an Excel workbook stored in OneDrive or SharePoint without deleting cells or shifting neighboring data |
| `copy-item` ·common | `oneDrive.copyItem()` | `--item-id` | 9 | Copy a DriveItem (file or folder) to a new location asynchronously |
| `create-item-permission` ·common | `oneDrive.createItemPermission()` | `--drive-id` `--drive-item-id` `--granted-to-v2` `--roles` | 0 | Create a new permission on a OneDrive drive item |
| `create-link` ·common | `oneDrive.createLink()` | `--item-id` `--type` | 9 | Create a sharing link for a DriveItem (file or folder) by its unique ID |
| `create-sharepoint-list-item` ·common | `oneDrive.createSharepointListItem()` | `--fields` `--list-id` `--site-id` | 0 | Create an item in a SharePoint list using Microsoft Graph through the OneDrive connection |
| `delete-item` ·common | `oneDrive.deleteItem()` | `--item-id` | 3 | Delete a DriveItem (file or folder) by its unique ID from the authenticated user's OneDrive |
| `delete-item-permanently` ·common | `oneDrive.deleteItemPermanently()` | `--drive-id` `--item-id` | 0 | Permanently delete a driveItem by its ID without moving it to the recycle bin |
| `delete-item-permission` ·common | `oneDrive.deleteItemPermission()` | `--item-id` `--perm-id` | 4 | Delete a permission from a drive item |
| `delete-share-permission` ·common | `oneDrive.deleteSharePermission()` | `--shared-drive-item-id` | 0 | Delete the permission navigation property for a shared drive item |
| `delete-sharepoint-item-permission` ·common | `oneDrive.deleteSharepointItemPermission()` | `--list-id` `--permission-id` `--site-id` | 1 | Revoke a Microsoft Graph beta permission from a SharePoint list or list item |
| `delete-workbook-range` | `oneDrive.deleteWorkbookRange()` | `--drive-id` `--item-id` `--range` `--shift` `--worksheet` | 0 | Deletes a range of cells from a worksheet in an Excel workbook stored in OneDrive |
| `delete-workbook-worksheet` | `oneDrive.deleteWorkbookWorksheet()` | `--drive-id` `--item-id` `--worksheet-id-or-name` | 1 | Deletes a worksheet from a workbook in OneDrive by its ID or name |
| `discard-checkout` ·common | `oneDrive.discardCheckout()` | `--drive-id` `--drive-item-id` | 0 | Discard the checkout of a driveItem, releasing it and discarding any changes made while checked out |
| `download-file` | `oneDrive.downloadFile()` | `--file-name` `--item-id` | 4 | Downloads a file from a user's OneDrive using its item ID, which must refer to a file and not a folder |
| `download-file-by-path` | `oneDrive.downloadFileByPath()` | `--file-name` `--item-path` | 1 | Downloads the contents of a file from OneDrive by its path |
| `download-item-as-format` | `oneDrive.downloadItemAsFormat()` | `--file-name` `--format` | 4 | Download the contents of a driveItem converted to a specific format (e.g., PDF or HTML) |
| `download-item-version` | `oneDrive.downloadItemVersion()` | `--file-name` `--item-id` `--version-id` | 1 | Download the contents of a specific previous version of a drive item (file) |
| `follow-item` | `oneDrive.followItem()` | `--driveItem-id` `--drive-id` | 0 | Follow a driveItem (file or folder) in OneDrive or SharePoint |
| `get-document-comments` | `oneDrive.getDocumentComments()` | `--item-id` | 2 | Extracts comments from a Word .docx file in OneDrive |
| `get-drive` ·common | `oneDrive.getDrive()` | `--drive-id` | 2 | Retrieves the properties and relationships of a Drive resource by its unique ID |
| `get-drive-item-by-sharing-url` ·common | `oneDrive.getDriveItemBySharingUrl()` | — | 5 | Resolve a OneDrive/SharePoint sharing URL (or shareId) to a DriveItem with driveId and itemId |
| `get-followed-item` ·common | `oneDrive.getFollowedItem()` | `--driveItem-id` `--drive-id` | 0 | Retrieve a specific followed driveItem from a drive |
| `get-group-drive` ·common | `oneDrive.getGroupDrive()` | `--group-id` | 1 | Retrieve the document library (drive) for a Microsoft 365 group |
| `get-item` ·common | `oneDrive.getItem()` | `--item-id` | 3 | Retrieves the metadata of a DriveItem by its unique ID |
| `get-item-permissions` ·common | `oneDrive.getItemPermissions()` | — | 9 | Retrieves the permissions of a DriveItem by its unique ID within a specific Drive |
| `get-item-thumbnails` ·common | `oneDrive.getItemThumbnails()` | `--item-id` | 6 | Retrieve the thumbnails associated with a DriveItem |
| `get-item-versions` ·common | `oneDrive.getItemVersions()` | `--item-id` | 4 | Retrieve the version history of a DriveItem by its unique ID |
| `get-recent-items` ·common ·deprecated | `oneDrive.getRecentItems()` | — | 2 | Microsoft has deprecated the `GET /me/drive/recent` endpoint backing this action; it already runs in a degraded state and stops returning data after November 2026 |
| `get-root` ·common | `oneDrive.getRoot()` | — | 2 | Retrieve metadata for the root folder of the signed-in user's OneDrive |
| `get-share` | `oneDrive.getShare()` | `--share-id-or-encoded-sharing-url` | 2 | Access a shared DriveItem or collection of shared items using a shareId or encoded sharing URL |
| `get-shared-items` ·common ·deprecated | `oneDrive.getSharedItems()` | — | 1 | Use search-drive-items to find a specific shared file or list-onedrive-shared-items to list files shared from other people's OneDrive accounts |
| `get-sharepoint-list-items` ·common | `oneDrive.getSharepointListItems()` | `--list-id` `--site-id` | 8 | Get the items (list items) within a specific SharePoint list on a site |
| `get-site` ·common | `oneDrive.getSite()` | `--site-id` | 2 | Retrieves metadata for a specific SharePoint site by its ID |
| `get-site-page-content` ·common | `oneDrive.getSitePageContent()` | `--page-id` `--site-id` | 2 | Gets the content of a modern SharePoint site page |
| `get-special-folder` | `oneDrive.getSpecialFolder()` | `--special-folder-name` | 3 | Retrieve a special folder in OneDrive by name |
| `get-user` ·common | `oneDrive.getUser()` | `--user-id` | 1 | Retrieves the properties and profile information for a specific Microsoft user by their user ID or user principal name |
| `get-workbook-used-range` | `oneDrive.getWorkbookUsedRange()` | `--drive-id` `--item-id` `--worksheet-id-or-name` | 2 | Retrieves the used range of a worksheet in an Excel workbook stored in OneDrive or SharePoint without requiring the caller to know an explicit A1 range address |
| `get-workbook-worksheet` | `oneDrive.getWorkbookWorksheet()` | `--drive-id` `--item-id` `--worksheet-id-or-name` | 2 | Retrieves a specific worksheet from an Excel workbook stored in OneDrive or SharePoint using Microsoft Graph API |
| `grant-share-permission` ·common | `oneDrive.grantSharePermission()` | `--encoded-sharing-url` `--recipients` `--roles` | 0 | Grant users access to a link represented by a permission using an encoded sharing URL |
| `grant-sharepoint-item-permission` ·common | `oneDrive.grantSharepointItemPermission()` | `--granted-to-v2` `--list-id` `--roles` `--site-id` | 1 | Grant an application permission on a SharePoint list or list item using Microsoft Graph beta |
| `invite-user-to-item` ·common | `oneDrive.inviteUserToItem()` | `--item-id` `--recipients` `--roles` | 10 | Invite users or grant permissions to a specific item in a OneDrive drive |
| `list-activities` ·common | `oneDrive.listActivities()` | — | 3 | Retrieve recent activities on the authenticated user's OneDrive |
| `list-all-drive-items` | `oneDrive.listAllDriveItems()` | `--drive-id` | 4 | Lists a complete OneDrive or SharePoint drive safely, one Microsoft Graph delta page per invocation |
| `list-bundles` | `oneDrive.listBundles()` | `--drive-id` | 6 | Retrieve a list of bundle resources from a specified drive |
| `list-drives` ·common | `oneDrive.listDrives()` | — | 8 | Retrieve a list of Drive resources available to the authenticated user, or for a specific user, group, or site |
| `list-folder-children` | `oneDrive.listFolderChildren()` | — | 10 | List the direct children (files/folders) of a OneDrive/SharePoint folder by DriveItem ID or path |
| `list-item-activities` ·common | `oneDrive.listItemActivities()` | `--drive-id` `--item-id` | 0 | List recent activities for a specific item in a OneDrive drive |
| `list-onedrive-shared-items` ·common | `oneDrive.listOnedriveSharedItems()` | — | 3 | List files shared from other people's OneDrive accounts using Microsoft Graph Search match-all and a OneDrive-personal URL heuristic |
| `list-root-drive-changes` ·common | `oneDrive.listRootDriveChanges()` | — | 5 | List changes in the root of the user's primary drive using a delta token |
| `list-share-permissions` | `oneDrive.listSharePermissions()` | `--shared-drive-item-id` | 0 | Retrieve permission details for a shared OneDrive or SharePoint item using a share ID |
| `list-sharepoint-item-permissions` ·common | `oneDrive.listSharepointItemPermissions()` | `--list-id` `--site-id` | 4 | List Microsoft Graph beta permissions from a SharePoint list or list item |
| `list-sharepoint-list-items-delta` ·common | `oneDrive.listSharepointListItemsDelta()` | `--list-id` `--site-id` | 4 | Track changes to items in a SharePoint list using a delta query |
| `list-site-columns` ·common | `oneDrive.listSiteColumns()` | `--site-id` | 6 | List all column definitions for a SharePoint site |
| `list-site-items-delta` ·common | `oneDrive.listSiteItemsDelta()` | `--site-id` | 4 | Track changes to DriveItems in the default document library of a SharePoint site |
| `list-site-lists` ·common | `oneDrive.listSiteLists()` | `--site-id` | 6 | List all lists under a specific SharePoint site |
| `list-site-subsites` ·common | `oneDrive.listSiteSubsites()` | `--site-id` | 6 | List all subsites of a SharePoint site |
| `list-subscriptions` ·common | `oneDrive.listSubscriptions()` | — | 1 | List the current subscriptions for the authenticated user or app |
| `list-workbook-worksheets` ·common | `oneDrive.listWorkbookWorksheets()` | `--drive-id` `--item-id` | 4 | Retrieves a list of all worksheets in an Excel workbook stored in OneDrive or SharePoint |
| `move-item` ·common | `oneDrive.moveItem()` | `--itemId` `--parentReference` | 6 | Move a file or folder to a new parent folder in OneDrive |
| `onedrive-create-folder` | `oneDrive.onedriveCreateFolder()` | `--name` | 4 | Creates a new folder in the user's OneDrive with configurable conflict behavior, optionally within a specified parent_folder (by ID or full path from root) which, if not the root, must exist and be… |
| `onedrive-create-text-file` | `oneDrive.onedriveCreateTextFile()` | `--content` `--name` | 3 | Creates a new plain-text file with specified content in the authenticated user's personal OneDrive, using either the folder's unique ID or its absolute path relative to the user's OneDrive root… |
| `onedrive-find-file` | `oneDrive.onedriveFindFile()` | `--name` | 3 | Non-recursively finds an item (file or folder) in a specified OneDrive folder; if `folder` is provided as a path, it must actually exist |
| `onedrive-find-folder` | `oneDrive.onedriveFindFolder()` | — | 8 | Finds folders by name within an accessible parent folder in OneDrive, or lists all its direct child folders if no name is specified |
| `onedrive-list-items` | `oneDrive.onedriveListItems()` | — | 4 | Retrieves one page of files and folders as `driveItem` resources from the root of a specified user's OneDrive |
| `onedrive-upload-file` | `oneDrive.onedriveUploadFile()` | — | 14 | Uploads a file to a specified OneDrive folder, automatically creating the destination folder if it doesn't exist, renaming on conflict, and supporting large files via chunking |
| `preview-drive-item` ·common | `oneDrive.previewDriveItem()` | `--item-id` | 7 | Generates or retrieves a short-lived, permission-bound embeddable URL for a preview of a specific item |
| `read-workbook-range` ·common | `oneDrive.readWorkbookRange()` | `--address` `--drive-id` `--item-id` `--worksheet-id-or-name` | 2 | Reads a range of cells from an Excel workbook worksheet stored in OneDrive or SharePoint using Microsoft Graph API |
| `restore-drive-item` ·common | `oneDrive.restoreDriveItem()` | `--item-id` | 3 | Restore a deleted OneDrive driveItem (file or folder) from the recycle bin |
| `restore-item-version` ·common | `oneDrive.restoreItemVersion()` | `--item-id` `--version-id` | 2 | Restores a previous version of a DriveItem (file) by creating a new version with the content of the specified version |
| `search-drive-items` ·common | `oneDrive.searchDriveItems()` | `--query` | 3 | Search OneDrive and accessible SharePoint files with Microsoft Graph Search |
| `search-items` ·common | `oneDrive.searchItems()` | `--q` | 12 | Search OneDrive for files and folders by keyword |
| `unfollow-item` ·common | `oneDrive.unfollowItem()` | `--id` | 0 | Unfollow a driveItem by removing it from the user's followed items collection |
| `update-drive-item-metadata` ·common | `oneDrive.updateDriveItemMetadata()` | `--item-id` | 10 | Update the metadata of a specific item (file or folder) in OneDrive |
| `update-drive-items-permissions` ·common | `oneDrive.updateDriveItemsPermissions()` | `--item-id` `--permission-id` `--roles` | 4 | Update the roles of an existing permission on a OneDrive drive item |
| `update-file-content` | `oneDrive.updateFileContent()` | `--item-id` | 12 | Update an existing file's content in OneDrive |
| `update-sharepoint-item-permission` ·common | `oneDrive.updateSharepointItemPermission()` | `--list-id` `--permission-id` `--roles` `--site-id` | 1 | Update an application permission on a SharePoint list or list item using Microsoft Graph beta |
| `update-sharepoint-list-item-fields` ·common | `oneDrive.updateSharepointListItemFields()` | `--fields` `--item-id` `--list-id` `--site-id` | 1 | Update field values on a SharePoint list item using Microsoft Graph through the OneDrive connection |
| `update-workbook-range` | `oneDrive.updateWorkbookRange()` | `--address` `--drive-id` `--item-id` `--worksheet-id-or-name` | 4 | Updates a range in a workbook worksheet using Microsoft Graph API |
| `update-workbook-worksheet` | `oneDrive.updateWorkbookWorksheet()` | `--drive-id` `--item-id` `--worksheet-id-or-name` | 4 | Updates properties of a worksheet in an Excel workbook stored in OneDrive |
| `write-workbook-cell` ·common | `oneDrive.writeWorkbookCell()` | `--column` `--drive-id` `--item-id` `--row` `--worksheet-id-or-name` | 4 | Updates the value, formula, or format of a specific cell in an Excel workbook stored in OneDrive |

## Triggers

`oneDrive.on("<event>", handler)` in a script; required config goes before the handler as an object.

| Event | Name | Required config | Description |
|---|---|---|---|
| `"base"` | Onedrivebasetrigger | — | Base trigger for OneDrive changes using Gmail-style state management |
| `"file-created"` | OneDrive File Created Trigger | — | Triggers when a new file is created in OneDrive |
| `"file-updated"` | File Updated | — | Trigger that fires when a OneDrive file's content or metadata changes |
| `"folder-created"` | OneDrive Folder Created Trigger | — | Triggers when a new folder is created in OneDrive |
| `"item-deleted"` | OneDrive Item Deleted Trigger | — | Triggers when a file or folder is deleted in OneDrive |
| `"item-moved-or-renamed"` | Item Moved or Renamed | — | Triggers when a file or folder is moved to a different path or renamed in OneDrive |
| `"item-updated"` | OneDrive Item Updated Trigger | — | Triggers when an existing file or folder is modified in OneDrive |
| `"new-version-created"` | New Version Created | `item_id` | Trigger that fires when a new version of a specified OneDrive file is created |
| `"sharing-permission-changed"` | Sharing Permission Added or Removed | — | Sharing Permission Added or Removed |

## Docs

- [run CLI](https://docs.boxd.sh/cli/run): Call connected integrations from the shell, connect new ones, and run automations.
- [Quickstart](https://docs.boxd.sh/guides/integrations/quickstart): Connect an integration, call it from the shell, and turn a script into an automation.
- [Connections](https://docs.boxd.sh/guides/integrations/connections): Connect an account once, for yourself or for your whole organization.
- [Scripts](https://docs.boxd.sh/guides/automations/scripts): Typed integrations, triggers, schedules and state in a .run.ts file.
- [Jobs](https://docs.boxd.sh/guides/automations/jobs): How a script becomes a background job: states, retries, sleep and wake.
- [Beyond the catalog](https://docs.boxd.sh/guides/automations/beyond-the-catalog): Reach your own APIs, databases and cloud accounts from a script.
