Sharepoint & Onedrive
StackOne File Picker Integrations: SharePoint vs OneDrive
StackOne provides robust support for file selection from Microsoft SharePoint and OneDrive, using Microsoft Graph API under the hood. While both services use the same API surface, their data models, hierarchies, and access scopes differ, especially around SharePoint’s site-based structure.
This document outlines how StackOne models and integrates these services in a consistent developer-facing experience.
File Picker Overview
-
Native File Picker: Both SharePoint and OneDrive use Microsoft’s native file picker components for the file and folder interface.
-
Custom Site Picker (SharePoint only): For SharePoint, StackOne builds a custom site selection layer on top of the native picker. This allows users to:
- Choose a SharePoint site
- Then proceed to the native SharePoint file picker scoped to that site’s drives and folders
-
Unified Selection Model: Regardless of source (SharePoint or OneDrive), selected files and folders are normalized into a common StackOne format in both UI and API.
Technical Architecture Comparison
Feature / Concept | SharePoint | OneDrive |
---|---|---|
File Storage Model | Organization → Sites → Drives → Folders → Files | Drive → Folders → Files |
Site Abstraction | Required. Files are grouped under named SharePoint sites | Not applicable. One flat drive per user |
Drives per Site | One or more drives per site (typically document libraries) | Single drive per user |
Multi-Site Support | Yes. StackOne iterates all accessible sites and drives | Not applicable |
Graph API Root Endpoint | /sites/{site-id}/drives/{drive-id} | /me/drive or /users/{user-id}/drive |
File Discovery in Picker | Site selection (custom) → Native SharePoint picker for drive/folder browsing | Direct native picker for user’s OneDrive content |
Pages Support | SharePoint Pages (e.g. .aspx ) are excluded from file API responses | N/A |
File List API Behavior | StackOne aggregates and returns all files from all sites/drives in a unified list via /files | StackOne returns files from the user’s OneDrive drive via /files |
Underlying Picker UI | Native SharePoint file picker (after custom site selection) | Native OneDrive file picker |
StackOne Modeling Strategy
Both integrations are abstracted into the same file model and API schema. Internally:
Object Type | StackOne Model Notes |
---|---|
File | Includes id , name , path , mime_type , size , modified_at , download_url , source |
Folder | Includes id , name , path , parent_id , and owner_id if browsing recursively |
Drive | Mapped directly from Graph API; grouped under sites for SharePoint |
Site (SharePoint only) | Populated via Graph API, shown to users as custom selector before native picker |
API Comparison
Here’s how the underlying Microsoft Graph API calls differ between the two integrations.
Operation | SharePoint | OneDrive |
---|---|---|
Discover sites | GET /sites?search=* or GET /sites/{tenant}.sharepoint.com/sites | N/A |
List drives in a site | GET /sites/{site-id}/drives | N/A (one drive per user) |
List root folder contents | GET /sites/{site-id}/drives/{drive-id}/root/children | GET /me/drive/root/children |
Get file metadata | GET /sites/{site-id}/drives/{drive-id}/items/{item-id} | GET /me/drive/items/{item-id} |
Download file | GET /sites/{site-id}/drives/{drive-id}/items/{item-id}/content | GET /me/drive/items/{item-id}/content |
StackOne file listing | Aggregated from all sites/drives into one list | Pulled from user’s root drive |
Implementation Details
-
Authentication:
-
Microsoft Identity Platform (OAuth 2.0)
-
Required scopes:
Files.Read
,Files.Read.All
Sites.Read.All
(SharePoint only)
-
-
Pagination Support:
- All Microsoft Graph list endpoints are paginated via
@odata.nextLink
- StackOne SDKs handle pagination and aggregation transparently
- All Microsoft Graph list endpoints are paginated via
-
File Filtering:
- SharePoint Pages (HTML content) are excluded
- OneDrive integration shows files as they appear in the user’s drive (including shared items)
-
Caching Strategy:
- Site metadata in SharePoint may be cached per session for performance
- Drives and folders are lazily loaded as users navigate via the picker
Summary
Area | SharePoint | OneDrive |
---|---|---|
Picker UX | Native SharePoint picker with custom site step | Native OneDrive picker |
Scoping Model | Site → Drive → Folder → File | Drive → Folder → File |
File List API | Aggregated across all sites | Scoped to single personal/business drive |
API Surface | Microsoft Graph | Microsoft Graph |
StackOne File Object Output | Unified format | Unified format |
Let me know if you’d like this exported to Markdown, Notion, or built into an internal developer doc format.