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 / ConceptSharePointOneDrive
File Storage ModelOrganization → Sites → Drives → Folders → FilesDrive → Folders → Files
Site AbstractionRequired. Files are grouped under named SharePoint sitesNot applicable. One flat drive per user
Drives per SiteOne or more drives per site (typically document libraries)Single drive per user
Multi-Site SupportYes. StackOne iterates all accessible sites and drivesNot applicable
Graph API Root Endpoint/sites/{site-id}/drives/{drive-id}/me/drive or /users/{user-id}/drive
File Discovery in PickerSite selection (custom) → Native SharePoint picker for drive/folder browsingDirect native picker for user’s OneDrive content
Pages SupportSharePoint Pages (e.g. .aspx) are excluded from file API responsesN/A
File List API BehaviorStackOne aggregates and returns all files from all sites/drives in a unified list via /filesStackOne returns files from the user’s OneDrive drive via /files
Underlying Picker UINative 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 TypeStackOne Model Notes
FileIncludes id, name, path, mime_type, size, modified_at, download_url, source
FolderIncludes id, name, path, parent_id, and owner_id if browsing recursively
DriveMapped 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.

OperationSharePointOneDrive
Discover sitesGET /sites?search=* or GET /sites/{tenant}.sharepoint.com/sitesN/A
List drives in a siteGET /sites/{site-id}/drivesN/A (one drive per user)
List root folder contentsGET /sites/{site-id}/drives/{drive-id}/root/childrenGET /me/drive/root/children
Get file metadataGET /sites/{site-id}/drives/{drive-id}/items/{item-id}GET /me/drive/items/{item-id}
Download fileGET /sites/{site-id}/drives/{drive-id}/items/{item-id}/contentGET /me/drive/items/{item-id}/content
StackOne file listingAggregated from all sites/drives into one listPulled 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
  • 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

AreaSharePointOneDrive
Picker UXNative SharePoint picker with custom site stepNative OneDrive picker
Scoping ModelSite → Drive → Folder → FileDrive → Folder → File
File List APIAggregated across all sitesScoped to single personal/business drive
API SurfaceMicrosoft GraphMicrosoft Graph
StackOne File Object OutputUnified formatUnified format

Let me know if you’d like this exported to Markdown, Notion, or built into an internal developer doc format.