Automatically upload files from a form’s File Upload field to Microsoft OneDrive, so attachments land in your cloud storage as soon as visitors upload them. OneDrive requires Contactum Pro with the OneDrive module enabled.
Requirements #
- Contactum Pro, with the OneDrive module active (Contactum → Modules)
- A Microsoft account and an App Registration in the Azure Portal (Entra ID)
- Your app’s Application (client) ID and a Client Secret
1. Create an Azure App Registration #
- In the Azure Portal (Entra ID), create a new App Registration.
- If you want to connect a personal OneDrive (not a work/school account), make sure Supported account types includes personal Microsoft accounts — this is easy to miss and a common source of consent errors later.
- Under Certificates & secrets, create a new client secret and copy its Value immediately (Microsoft only shows it once).
- Copy the app’s Application (client) ID.
- Add the exact Redirect URI Contactum shows you (see step 2 below) as a Web platform redirect URI on the App Registration.
2. Connect OneDrive in Contactum #
- Go to Contactum → Settings → Integrations → OneDrive.
- Paste in your Application (client) ID and Client Secret.
- Optionally set a Path Prefix — a leading folder applied to every upload (default:
/contactum-uploads), created automatically if needed. - Copy the Redirect URI shown on the page (
{your-site}/wp-admin/?contactum_onedrive_auth=1) into the App Registration’s Redirect URIs, if you haven’t already. - Click Connect OneDrive.
You’re redirected to Microsoft to sign in and consent. After approving, you’re sent back to Contactum and the status turns green. As with Dropbox, there’s no separate live test call — the connection is only confirmed once the full authorization round-trip completes.
To disconnect, click Disconnect OneDrive — this clears the stored tokens and stops all uploads until reconnected.
3. Enable OneDrive on a Specific Form #
- Open the form in the builder.
- Go to Form Settings → Integrations.
- Toggle OneDrive on, then click Configure.
4. Configure Upload Settings #
| Field | Description |
|---|---|
| Enable OneDrive for this form | Turns OneDrive uploads on for this specific form |
| Folder | A folder path appended after the global Path Prefix, e.g. form-7 (leave blank to use just the global default). Typed, not a picker |
| Delete local copy after upload | Removes the file from your WordPress server once it’s safely uploaded to OneDrive |
No field mapping — this integration handles files only.
5. How It Works #
Like Dropbox, OneDrive uploads happen as soon as a visitor selects a file, not when they click the form’s final Submit button:
- Contactum checks the form has OneDrive enabled and the global connection is active.
- The destination path is built from the global Path Prefix + this form’s Folder + the original filename.
- Small files upload directly; larger files (roughly over 4MB) use a Microsoft Graph upload session, sent in a single request — good for typical form attachments, but very large files could time out since it isn’t a true resumable/chunked upload.
- On success, Contactum stores the file’s OneDrive link on its WordPress attachment.
A failed upload does not block form submission, and is recorded in Contactum’s API Log for review.
A Microsoft-specific detail worth knowing: Microsoft rotates your refresh token every time it’s used — Contactum automatically saves the new one each time. If you ever notice OneDrive uploads that used to work suddenly stop, the fix is simply to reconnect via Disconnect OneDrive → Connect OneDrive again.
Troubleshooting #
Files aren’t uploading to OneDrive #
- Confirm the form has OneDrive toggled on and was saved.
- Confirm the global connection still shows verified.
- Check the API Log (Contactum → Tools → API Log, if available) for a logged failure and its error message.
“AADSTS…” error when connecting #
- This is a Microsoft consent error. If you’re connecting a personal Microsoft account, confirm your App Registration’s Supported account types was set to include personal accounts.
Uploads worked before but suddenly stopped #
- Reconnect (Disconnect OneDrive, then Connect OneDrive) — this is almost always a refresh-token issue on Microsoft’s side.
Very large file uploads are failing #
- OneDrive uploads here aren’t true chunked uploads; extremely large attachments may time out. Consider reducing your form’s maximum file size for the affected field.
Notes #
- Requires Contactum Pro with the OneDrive module active — not available in the free plugin.
- Auth method: OAuth2 via the Microsoft identity platform, with automatic token refresh (and Microsoft-side refresh token rotation).
- Credentials storage: app credentials and tokens are stored in
wp_optionsunder the keycontactum_onedrive.