> ## Documentation Index
> Fetch the complete documentation index at: https://documentation.deepmask.io/llms.txt
> Use this file to discover all available pages before exploring further.

# OneDrive

> A reference for every OneDrive action available in DeepMask — what each one does, when to use it, and what parameters it accepts.

## Overview

DeepMask exposes a set of read-only OneDrive actions that let users browse their drive, retrieve file metadata, view recent and shared files, search for content, and download file text — all scoped to what the signed-in user already has access to.

Actions are grouped into three categories:

| Category   | Actions | Purpose                                                          |
| ---------- | ------- | ---------------------------------------------------------------- |
| **Drive**  | 5       | Browse the drive, folders, items, recent files, and shared files |
| **Search** | 1       | Search files and folders by name or content                      |
| **Files**  | 1       | Download the text content of a file                              |

<Info>
  All OneDrive actions are read-only. DeepMask cannot create, modify, or delete files or folders. Every action runs on behalf of the signed-in user — they can only access content they already have permission to see.
</Info>

### Drive

| Action                         | Description                                                                                   |
| ------------------------------ | --------------------------------------------------------------------------------------------- |
| `onedrive_get_drive`           | Returns the user's OneDrive metadata — name, type, owner, and storage quota.                  |
| `onedrive_list_items`          | Lists files and sub-folders in a OneDrive folder. Use `folder_id="root"` to start at the top. |
| `onedrive_get_item`            | Returns metadata for a specific file or folder by its item ID.                                |
| `onedrive_list_recent`         | Lists files recently accessed or modified, ordered most-recent first.                         |
| `onedrive_list_shared_with_me` | Lists files and folders that others have shared with the signed-in user.                      |

### Search

| Action                  | Description                                                                                        |
| ----------------------- | -------------------------------------------------------------------------------------------------- |
| `onedrive_search_files` | Searches across files and folders by name or content. Returns item IDs for use with other actions. |

### Files

| Action                      | Description                                                                                        |
| --------------------------- | -------------------------------------------------------------------------------------------------- |
| `onedrive_get_file_content` | Downloads and returns the text content of a file. Best for `.txt`, `.csv`, `.json`, `.xml`, `.md`. |

***

## Prerequisites

Before using OneDrive actions in DeepMask, confirm the following are in place.

### Required Access

* **Microsoft 365 account (Business Basic or higher)** — Your organization must have an active Microsoft 365 or Office 365 subscription with OneDrive enabled.
* **User signed in via Microsoft** — Each user must sign in with their own Microsoft account through DeepMask's connector. Actions run under that user's identity and are limited to content they already have access to.

### What You Do Not Need

* No developer tools, code, or command-line experience
* No changes to existing OneDrive permissions
* No service account or shared credentials

<Info>
  DeepMask uses OAuth 2.0 delegated authentication. When a user connects their account, they sign in with their own Microsoft credentials. DeepMask never stores passwords or receives broader access than the user already has in your tenant.
</Info>

***

## Common Parameters

Several parameters appear across multiple actions.

| Parameter         | Type                       | Description                                                                                                       |
| ----------------- | -------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| `response_format` | `"markdown"` \| `"json"`   | Controls the output format. `"markdown"` (default) returns human-readable text; `"json"` returns structured data. |
| `limit`           | number (1–100, default 20) | Maximum number of results to return in a single call.                                                             |
| `offset`          | number (default 0)         | Number of results to skip. Use with `limit` to page through large result sets.                                    |

***

## Typical Workflows

### Browsing your OneDrive

<Steps>
  <Step title="Check drive info">
    Call `onedrive_get_drive` to confirm the drive is accessible and check storage quota.
  </Step>

  <Step title="List the root folder">
    Call `onedrive_list_items` with `folder_id="root"` to see top-level files and folders.
  </Step>

  <Step title="Drill into a folder">
    Pass a folder's `id` from the listing as `folder_id` to browse its contents.
  </Step>

  <Step title="Read a file">
    Call `onedrive_get_file_content` with the file's `id` as `item_id` to download its text content.
  </Step>
</Steps>

### Finding a file by keyword

<Steps>
  <Step title="Search files">
    Call `onedrive_search_files` with a keyword. Results include `itemId`, name, path, and size.
  </Step>

  <Step title="Read or inspect">
    Pass the `itemId` to `onedrive_get_file_content` (for text content) or `onedrive_get_item` (for metadata).
  </Step>
</Steps>

### Checking recent or shared files

<Steps>
  <Step title="View recent files">
    Call `onedrive_list_recent` to see files the user has recently accessed or modified.
  </Step>

  <Step title="View files shared with you">
    Call `onedrive_list_shared_with_me` to see files others have shared with the signed-in user.
  </Step>
</Steps>

***

## Pagination

Actions that return lists (`onedrive_list_items`, `onedrive_list_shared_with_me`, `onedrive_search_files`) support pagination via `limit` and `offset`.

| Field in response | Description                                                 |
| ----------------- | ----------------------------------------------------------- |
| `count`           | Number of items in this page                                |
| `total_count`     | Total matching items (where available)                      |
| `has_more`        | `true` if there are more pages                              |
| `next_offset`     | Pass this as `offset` in the next call to get the next page |

<Info>
  `onedrive_list_recent` does not support offset paging. It returns up to `limit` most-recently accessed files in a single call.
</Info>

***

## Security & Privacy

DeepMask is designed so that you retain full control of your data and your users' access. This section explains the key security properties of the OneDrive integration.

### Delegated Authentication

DeepMask uses OAuth 2.0 delegated permissions, not application-level (app-only) permissions. This means:

* Every action performed by DeepMask is done on behalf of the signed-in user.
* A user can only access OneDrive content they already have permission to see.
* DeepMask cannot bypass OneDrive's existing access controls.
* Removing a user's OneDrive access in Microsoft 365 immediately removes their access in DeepMask.

### No Stored Credentials

DeepMask does not store your Microsoft password or raw file content. Authentication is handled entirely through short-lived OAuth access tokens and refresh tokens, which are encrypted at rest.

### No Service Account

DeepMask authenticates each user individually. This ensures audit logs in your Microsoft 365 tenant accurately reflect which user accessed which content.

### Read-Only Permissions

All OneDrive actions are strictly read-only. DeepMask requests no write or delete permissions — it cannot create, modify, or delete files or folders.

The delegated Microsoft Graph permissions used by these actions are:

| Permission       | Actions that use it                           |
| ---------------- | --------------------------------------------- |
| `User.Read`      | All actions (identity context)                |
| `Files.Read.All` | All drive, search, and file actions           |
| `offline_access` | Keeps the user's session active between calls |

### Revoking Access

To disconnect DeepMask from OneDrive at any time, go to DeepMask → **Connectors** → **OneDrive** and click **Disconnect**.

This immediately revokes all access tokens. No data is retained after disconnection.

<Info>
  Questions about data residency, compliance, or security? Contact DeepMask support at [support@deepmask.io](mailto:support@deepmask.io).
</Info>
