RedPlanetHQ/core

New Integration: OneDrive

Open

#486 opened on Feb 24, 2026

 (0 comments) (0 reactions) (0 assignees)TypeScript (184 forks)auto 404
enhancementgood first issueintegrationnew-featurenew-integration

Repository metrics

Stars
 (1,930 stars)
PR merge metrics
 (PR metrics pending)

Description

Description

Add OneDrive integration to sync files, folders, and document activity into CORE via Microsoft Graph API.

Reference Implementations

Existing Integrations (use as templates)

  • integrations/google-docs/ - Similar cloud document integration
  • integrations/google-sheets/ - Google Workspace file integration
  • integrations/github/ - For webhook and event patterns

Required Files Structure

integrations/onedrive/
├── src/
│   ├── index.ts          # Main entry, OAuth spec
│   ├── schedule.ts       # Sync logic
│   ├── utils.ts          # Microsoft Graph API utilities
│   ├── account-create.ts # OAuth setup
│   └── create-activity.ts # Activity formatting
├── package.json
├── tsup.config.ts
└── README.md

OneDrive API Integration (via Microsoft Graph)

OAuth Setup

  • Use OAuth 2.0 with Microsoft Identity Platform
  • Microsoft Graph base URL: https://graph.microsoft.com/v1.0
  • Required scopes:
    • Files.Read - Read user's files
    • Files.Read.All - Read all files user can access
    • Files.ReadWrite - Read and write user's files
    • User.Read - Read user profile
    • offline_access - Refresh tokens for long-lived access

Key Endpoints

  • GET /me/drive - Get current user's OneDrive
  • GET /me/drive/root/children - List items in root folder
  • GET /me/drive/items/{item-id} - Get item metadata
  • GET /me/drive/items/{item-id}/children - List folder contents
  • GET /me/drive/root:/{path} - Access items by path
  • GET /me/drive/items/{item-id}/content - Download file content
  • GET /drives/{drive-id}/items/{item-id} - Access shared drives
  • GET /me/drive/items/{item-id}/delta - Track changes (delta sync)
  • POST /subscriptions - Create webhook subscriptions for change notifications

Core Resources

  • Drive - Logical container of files (document library or user's OneDrive)
  • DriveItem - Item within a drive (document, photo, video, folder)

Events to Track

  1. Files - File created, modified, renamed, deleted, moved
  2. Folders - Folder created, renamed, deleted, reorganized
  3. Sharing - Files shared, permissions changed
  4. Versions - File version history changes
  5. Sync Activity - Delta changes for incremental sync

Implementation Tasks

  • Set up basic integration structure following integrations/github/src/index.ts pattern
  • Implement OAuth 2.0 flow with Microsoft Identity Platform in account-create.ts
  • Create API utilities in utils.ts for Microsoft Graph API
  • Implement sync logic in schedule.ts using delta queries for incremental sync
  • Set up webhook subscriptions for real-time change notifications
  • Convert OneDrive events to CORE activity format
  • Add error handling and rate limiting
  • Create integration documentation
  • Add to integrations/README.md

Technical Notes

  • OneDrive is accessed through the Microsoft Graph API, not a standalone API
  • URL pattern: https://graph.microsoft.com/v1.0/{root-resource}/{onedrive-resource}
  • Delta queries (/delta endpoint) enable efficient incremental sync
  • Webhook subscriptions require a publicly accessible notification URL
  • Both personal OneDrive and OneDrive for Business are supported
  • The same API can access SharePoint document libraries

Resources

Labels

enhancement, integration, new-feature

Contributor guide