Configuring Node HTTP Request to Get, Read and Edit Files in Microsoft 360 with n8n

Tiempo de lectura: 2 minutos

We will today see how we can get data from Excel in Microsoft 360 using n8n.

Hotel - pexels

First, we will create an app and credentials from https://portal.azure.com/.

Login to your Microsoft account.

Search:

“App registrations” > click on “New registration”

We add the application name and select:

Accounts in any organizational directory (any Microsoft Entra multi-tenant tenant) and personal Microsoft accounts (for example, Skype, Xbox)

Now we go to n8n and create our new credential to obtain the URI of redirection:

To do this, we add the Http Request block:

Block HTTP Request

We open it and add the endpoint:

https://graph.microsoft.com/v1.0/me/drive/root/children

We have configured the credentials, for this we select Predefined Credential Type

Now we choose Micrsoft OAuth2 API.

We create a new:

The redirect URI is the OAuth Redirect URL

https://n8n.dominio.com/rest/oauth2-credential/callback

*Change n8n.dominio.com with your real data.

We are copying it to add it to the app we’re creating from Microsoft 360 and now we select type > web.

We click on register.

ID Application Microsoft 360

You can paste it inside the n8n credentials we are creating.

Client ID n8n Microsoft 360

You will now create the Client ID

We click on Client Credentials > Add Certificate or Secret

We click on New Client Secret, fill in the data and copy the VALUE.

We paste into the Secret Client in our credentials configuration for n8n.

Now we click on Connect My Account and a connection window will appear.

It will ask us if we allow n8n to access our One Drive information. We click yes, and we’ll have the connection ready.

We can now select the permissions we need for our API by clicking on the Permissions API in the API Call section.

We can choose Microsoft Graph here.

Microsoft Graph

We chose Delegated Permissions and if we want to choose Excel, we will add the following permissions:

And now we have to add these scopes inside our credential, in the Scope section

User.Read offline_access Files.ReadWrite.All

Last step we click on Connect to account.

And now we can do the GET and get the files.

Leave a Comment