SharePoint Online and Oauth2 in Business Central OnPrem

SharePoint Online and Oauth2 in Business Central OnPrem

This week I was struggling with an OnPrem installation of Business Central, Oauth2 and SharePoint Online. It was hard to find any documentation of it. Maybe you already know how it work. But if not here is some documentation of it 😀.

As always if you are running Business Central Online it is much easier to integrate with (just follow the Excel Add-in Centralized Deployment assisted setup).

I think everybody is well know about the feature “Export to Excel” and “Open in Excel” in Business Central. And if you click on it in Business Central it is perfeclty downloaded the page into Excel (it gives you a download). But what if you want to put it on an SharePoint Online tenant. For that you must go to the “Microsoft SharePoint Connection Setup”:

Geen alternatieve tekst opgegeven voor deze afbeelding
Here you can setup your SharePoint Online tenant in the Location field.
But if you leave the following fields empty:
  • “Document Repository”
  • “User Name”

The Excel will go into your personal OneDrive folder. So in this case you can only access and not the whole organisation.

Geen alternatieve tekst opgegeven voor deze afbeelding

But if you want it for the whole organisation you have to fill in “Document Repository” and “User Name” (here is a validation with the field “Authentication E-mail” from your user) and the excel file will be uploaded in your SharePoint tenant:

Geen alternatieve tekst opgegeven voor deze afbeelding

But how do you setup Oauth2 for SharePoint Online?

In the tab “Authentication” (this tab is only visible if you are onprem) you can put your “Client Id” and “Client Secret”.

Just go to your Azure Portal, create an application and assign the following “API permissions”:

Geen alternatieve tekst opgegeven voor deze afbeelding
Geen alternatieve tekst opgegeven voor deze afbeelding
Geen alternatieve tekst opgegeven voor deze afbeelding

Fill these values in Business Central and you are connected with SharePoint Online from an Business Central Onprem installation 👍.

Leave a Reply

Your email address will not be published.