FileRelay
Documentation
Try for Free

OneDrive

Forward SAP documents to OneDrive personal or business drives. Supports folder paths, specific drive targeting, and automatic folder creation.

Use Cases

  • Microsoft 365 document archive
  • Personal library storage for SAP documents
  • OneDrive for Business team file distribution

Forward SAP documents to Microsoft OneDrive. FileRelay uses the Microsoft Graph API to upload files to personal or business OneDrive accounts, with automatic folder creation and chunked upload for large files.

Setup

  1. Go to the Azure Portal and navigate to Azure Active Directory > App registrations
  2. Click New registration, give the app a name (e.g. "FileRelay OneDrive"), and set the supported account type
  3. Under API permissions, click Add a permission > Microsoft Graph > Delegated permissions and add:
    • Files.ReadWrite — read and write the user's files
    • offline_access — maintain a refresh token for background operation
  4. Click Grant admin consent for the permissions
  5. Go to Certificates & secrets and create a new Client secret; copy the secret value immediately
  6. Note the Application (client) ID from the Overview page and the Directory (tenant) ID
  7. Complete the OAuth 2.0 authorization code flow to obtain a refresh token:
    • Direct a browser to https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/authorize?client_id={client_id}&response_type=code&scope=Files.ReadWrite%20offline_access&redirect_uri={redirect_uri}
    • Exchange the authorization code at the /oauth2/v2.0/token endpoint for an access token and refresh token
  8. In FileRelay, add a OneDrive destination with the Client ID, Client Secret, Tenant ID, and Refresh Token

REPLACE: Screenshot of the OneDrive connector configuration form in FileRelay

How It Works

FileRelay uses the Microsoft Graph API to authenticate via the OAuth 2.0 refresh token flow. On each upload, it exchanges the refresh token for a short-lived access token, resolves the target drive and folder path, and uploads the document.

For files larger than 4MB, FileRelay automatically creates an upload session and uses chunked upload — no configuration needed. This handles files up to 250GB reliably.

Folder Structure

Documents are uploaded to:

{folder_path}/{subfolder}/{doc_id}.{ext}
  • folder_path — the configured path (e.g. SAP/Invoices), or root if omitted
  • subfolder — automatic subfolder based on routing rules (date, repository, or none)
  • doc_id — the SAP document ID
  • ext — file extension based on MIME type

Folders are created automatically if they do not exist. FileRelay creates each level of the path as needed.

Drive Targeting

By default, FileRelay uploads to the authenticated user's primary OneDrive. To target a different drive, set the drive_id field:

  • Another user's drive — Requires application-level permissions (Files.ReadWrite.All) and the target user's drive ID
  • SharePoint document library — For SharePoint sites, use the dedicated SharePoint connector instead, which provides better support for site resolution and library targeting

You can find a user's drive ID using the Graph Explorer:

GET https://graph.microsoft.com/v1.0/me/drives

Each drive object includes an id field.

Azure AD Permissions

Permission Type Purpose
Files.ReadWrite Delegated Read and write files in the user's OneDrive
offline_access Delegated Maintain a refresh token for background access

For application-level access without a user context, use Files.ReadWrite.All as an Application permission and grant admin consent. This allows access to any user's OneDrive in the tenant.

Tips

  • OneDrive for Business vs Personal — Both are supported. Set tenant_id to consumers for personal Microsoft accounts, or use your organization's tenant ID for business accounts.
  • Storage limits — OneDrive for Business typically provides 1TB per user. Monitor usage if archiving large volumes of SAP documents. Storage limits can be increased by an admin.
  • Path separators — Use forward slashes in folder_path (e.g. SAP/Invoices/2026). FileRelay normalizes paths automatically.
  • Concurrent uploads — FileRelay handles concurrent uploads gracefully. Multiple routing rules can target the same OneDrive folder without conflicts.
  • Token refresh — Microsoft refresh tokens for multi-tenant apps remain valid as long as they are used at least once every 90 days. FileRelay refreshes tokens on every upload, so expiry is not a concern during normal operation.
  • Conditional access policies — If your Azure AD tenant has conditional access policies, ensure the FileRelay app registration is not blocked by location or device-based restrictions.

Configuration Fields

FieldTypeRequiredDescription
folder_pathstringOptionalFolder path within OneDrive (e.g. SAP/Invoices)
drive_idstringOptionalSpecific drive ID (default: authenticated user's drive)

Credentials

FieldTypeRequiredDescription
client_idstringRequiredAzure AD Application Client ID
client_secretstringRequiredAzure AD Client Secret
tenant_idstringRequiredAzure AD Tenant ID
refresh_tokenstringRequiredOAuth 2.0 refresh token

All credentials are encrypted at rest using envelope encryption.

Ready to set up OneDrive?

Create a free account and add this connector in under 2 minutes.

Get Started Free