Odoo SharePoint Integration
for Document Management

Built a connection between Odoo and SharePoint through the Microsoft Graph API so that the documents attached to a client's business records live in SharePoint rather than as ordinary Odoo attachments. The Odoo side holds a single set of connection settings, Client ID, Client Secret, Tenant ID or Tenant Name, Site Name and Drive Name, entered once in Settings and used to authenticate against Microsoft Graph with the OAuth2 client credentials flow. On a Sale Order, Purchase Order, CRM Lead, Project, Project Task, Maintenance Equipment, Partner or Helpdesk Ticket, an Open SharePoint Folder button assigns the record a GUID if it does not already have one, then calls the Graph API to find or create a folder named after that GUID inside the parent folder that matches the record's type, and opens the resulting folder in a new browser tab. Separately, the Product Advanced Importer wizard can list the files sitting in a given SharePoint folder, let the user pick one, and pull it into Odoo to feed the Excel import flow.

SharePoint Integration - Odoo

1. Why This Integration

A client already keeps its day to day documents in Microsoft 365, and duplicating that storage inside Odoo as attachments means the same file living in two places, updated in one and forgotten in the other. The integration keeps SharePoint as the place documents actually live and lets Odoo point at it instead of holding a copy. Because the folder for a record is named after a GUID rather than the record's name or reference, renaming a customer, closing an opportunity under a different title or renumbering a document later does not break the link between the Odoo record and its SharePoint folder, and no one on the team has to create or name a folder by hand. The same reasoning applies to product data: instead of a colleague downloading a spreadsheet from SharePoint and re-uploading it into the importer, the importer reaches into the folder directly and brings the file in.

2. Prerequisites

The integration needs a Microsoft 365 tenant with a SharePoint site and a document library, referred to here as the drive, already in place, since the connector reads and writes into that existing structure rather than provisioning a site of its own. It also needs an application registered in Azure Active Directory with a client secret and with admin consent granted on the Microsoft Graph application permission that allows read and write access to SharePoint sites, because the connector authenticates as the application itself and not as a signed in user. On the Odoo side, the server needs outbound HTTPS access to login.microsoftonline.com to obtain a token and to graph.microsoft.com to make the site, drive and folder calls that follow.

3. Setup on the Microsoft 365 Side

An administrator sets this up from the Azure portal, starting at Home and opening App registrations, since every application that is going to call Microsoft Graph on the tenant's behalf has to exist as a registered app first.

New registration on that page opens the form where the app itself is created.

A name is given to the app, the supported account type is left on the tenant's own organizational directory, and the redirect URI is left blank since this app never signs a user in interactively, then Register creates it.

Once the app exists, its Overview page carries the Application (client) ID and the Directory (tenant) ID that the connector will need, alongside the Tenant Name read from the same directory.

Under API permissions, a Microsoft Graph application permission granting read and write access to SharePoint sites is added, since the connector reaches SharePoint as the application rather than as a signed in user, and an application permission does not work without it.

That permission only takes effect once Grant admin consent is confirmed for the tenant, without which the calls from Odoo are rejected regardless of how correct the credentials are.

A client secret is generated next, under Certificates & secrets, giving it a description and an expiry period.

The Value shown once the secret is created is the Client Secret itself, copied at that moment since Azure does not display it again afterwards; the Secret ID next to it is only a label and is not what the connector authenticates with.

With the app, its permission and the secret in place, the Site Name and Drive Name are noted from the target SharePoint site and its document library, and the type specific parent folders, quote, Purchase, opportunity, project, task, Instrument, account and Ticket, are expected to live inside that drive, with the connector creating a record's own GUID folder inside the matching one the first time that record's button is used.

4. Authentication and Configuration in Odoo

In Odoo, the Client ID, Client Secret, Tenant ID or Tenant Name, Site Name and Drive Name are entered once in Settings. From these, the connector requests a token from Microsoft using the OAuth2 client credentials grant, which is an application to application exchange rather than a per user login, so no one has to sign into SharePoint from within Odoo and the connector keeps working unattended once configured. The token returned is used as a bearer token on every subsequent Graph API call, and because access is granted to the application rather than to a person, what the connector can reach in SharePoint is exactly what was consented to on the Azure app registration, so tightening or widening that permission is done in Azure rather than in Odoo.

5. Opening a Record's SharePoint Folder

The Open SharePoint Folder button appears on a Sale Order, Purchase Order, CRM Lead, Project, Project Task, Maintenance Equipment, Partner and Helpdesk Ticket. Clicking it first checks whether the record already carries a GUID, and generates and stores one if it does not, so that value becomes the permanent identity of that record's folder for as long as the record exists. The connector then calls the Graph API to look for a folder named after that GUID inside the parent folder that matches the record's type, quote for a Sale Order, Purchase for a Purchase Order, opportunity for a CRM Lead, project for a Project, task for a Project Task, Instrument for a Maintenance Equipment, account for a Partner and Ticket for a Helpdesk Ticket. If the folder is not found it is created on the spot, and either way its URL is opened in a new browser tab, so the user lands directly inside the correct SharePoint folder ready to upload or review files, without ever having to browse the drive or name anything themselves.

6. Product Advanced Importer

Separately from the per record folder button, the Product Advanced Importer wizard is built for bulk product data. Given a SharePoint folder, identified by its GUID or its path, the wizard lists the files sitting inside it and lets the user pick the one they need. Selecting a file downloads it into Odoo through the same Graph API connection and feeds it straight into the Excel import flow, so a spreadsheet maintained in SharePoint by a supplier or a warehouse team is imported directly instead of first being downloaded to a laptop and then re-uploaded into Odoo.

Conclusion

The SharePoint integration keeps document storage where a client's team already works, in Microsoft 365, while giving Odoo a reliable way to reach it. Configuration is a single set of client credentials and site and drive names held in Settings, every key record gets a matching SharePoint folder identified by a GUID that survives renames, and that folder is one click away from the record itself. The same connection lets the Product Advanced Importer pull bulk product files straight out of SharePoint, so moving data between the two systems, whether it is a single document or a supplier spreadsheet, no longer means manually downloading, renaming or re-uploading anything.

Need SharePoint Integration?

Talk to our Odoo team about connecting SharePoint, or any other Microsoft 365 service, with your Odoo records.

WhatsApp