$npx -y skills add microsoft/power-platform-skills --skill add-onedriveAdds OneDrive for Business connector to a Power Apps code app. Use when uploading, downloading, listing, or managing files in OneDrive.
| 1 | **📋 Shared Instructions: [shared-instructions.md](${PLUGIN_ROOT}/shared/shared-instructions.md)** - Cross-cutting concerns. |
| 2 | |
| 3 | # Add OneDrive for Business |
| 4 | |
| 5 | ## Workflow |
| 6 | |
| 7 | 1. Check Memory Bank → 2. Add Connector → 3. Configure → 4. Build → 5. Update Memory Bank |
| 8 | |
| 9 | --- |
| 10 | |
| 11 | ### Step 1: Check Memory Bank |
| 12 | |
| 13 | Check for `memory-bank.md` per [shared-instructions.md](${PLUGIN_ROOT}/shared/shared-instructions.md). |
| 14 | |
| 15 | ### Step 2: Add Connector |
| 16 | |
| 17 | **First, find the connection ID** (see [connector-reference.md](${PLUGIN_ROOT}/shared/connector-reference.md)): |
| 18 | |
| 19 | Run the `/list-connections` skill. Find the OneDrive for Business connection in the output. If none exists, direct the user to create one using the environment-specific Connections URL — construct it from the active environment ID in context (from `power.config.json` or a prior step): `https://make.powerapps.com/environments/<environment-id>/connections` → **+ New connection** → search for the connector → Create. |
| 20 | |
| 21 | ```bash |
| 22 | npx power-apps add-data-source -a onedriveforbusiness -c <connection-id> |
| 23 | ``` |
| 24 | |
| 25 | ### Step 3: Configure |
| 26 | |
| 27 | Ask the user what file operations they need (list files, upload, download, create folder, etc.). |
| 28 | |
| 29 | **Common operations:** |
| 30 | |
| 31 | ```typescript |
| 32 | // List files in a folder |
| 33 | const files = await OneDriveForBusinessService.ListFolder({ |
| 34 | id: "root" // or folder ID |
| 35 | }); |
| 36 | |
| 37 | // Get file metadata |
| 38 | const metadata = await OneDriveForBusinessService.GetFileMetadata({ |
| 39 | id: "file-id" |
| 40 | }); |
| 41 | |
| 42 | // Get file content |
| 43 | const content = await OneDriveForBusinessService.GetFileContent({ |
| 44 | id: "file-id" |
| 45 | }); |
| 46 | |
| 47 | // Create file |
| 48 | await OneDriveForBusinessService.CreateFile({ |
| 49 | folderPath: "/Documents", |
| 50 | name: "report.txt", |
| 51 | body: "File content here" |
| 52 | }); |
| 53 | ``` |
| 54 | |
| 55 | **Key points:** |
| 56 | |
| 57 | - File and folder IDs can be obtained from `ListFolder` or `ListRootFolder` |
| 58 | - Use `folderPath` for creating files by path, `id` for accessing existing files |
| 59 | - Binary file content may need base64 encoding/decoding depending on the operation |
| 60 | |
| 61 | Use `Grep` to find specific methods in `src/generated/services/OneDriveForBusinessService.ts` (generated files can be very large -- see [connector-reference.md](${PLUGIN_ROOT}/shared/connector-reference.md#inspecting-large-generated-files)). |
| 62 | |
| 63 | ### Step 4: Build |
| 64 | |
| 65 | ```bash |
| 66 | npm run build |
| 67 | ``` |
| 68 | |
| 69 | Fix TypeScript errors before proceeding. Do NOT deploy yet. |
| 70 | |
| 71 | ### Step 5: Update Memory Bank |
| 72 | |
| 73 | Update `memory-bank.md` with: connector added, configured operations, build status. |