Connect Microsoft Exchange to n8n

Hello, I would like to sync the data from Microsoft exchange to n8n in one way.
So i think that we need to do it with the webhook and http request right?
Someone already did this?

Hey @Gabriele_Bracciali, are you talking about a local exchange server? I am not sure this supports webhooks or comes with a REST API tbh.

If you’re using Exchange Online you could consider using the Outlook node to fetch mails from a mailbox.

so if i am using an online exchange, how can i use the Outlook node to save the email and name of a contact?

Ah, I am afraid the node doesn’t currently support editing your address book :frowning_face:, so you would need the HTTP Request node for that. I believe this would be the required API, though I haven’t used it before so can’t share any advice on how to approach this.

Okay thank you very much, I need only to understand how to use http request in microsoft.

UP, Someone have another idea?

Hey @Gabriele_Bracciali, I am afraid not. I do not have experience with the respective API as mentioned above :frowning:. Did you try it out already? Which problem exactly did you run into?

For now I shall also convert your question into a feature request, meaning you and other users can vote on having this feature implemented in n8n. If you need urgent assistance with connecting an unsupported service with n8n you could also consider reaching out to an n8n expert who can work on this with you.

Yes, I have tried but doesn’t work.
I have tried to follow this docs
And they return me a lot of problem with Microsoft account.

I want only to make this callback request:
from microsoft graph and get the data in n8n
My issue now, is to connect the microsoft account in n8n

@MutedJam can you help me?

Hi @Gabriele_Bracciali, from looking at the documentation it seems this API uses OAuth2. So as a first step you’d need to register a new application in the Azure portal and run through the other steps described here: Register your app with the Azure AD v2.0 endpoint - Microsoft Graph | Microsoft Docs

After following this process, you would eventually get a client ID and a client secret which should allow you to configure generic OAuth2 credentials in n8n like this (you probably don’t need all these scopes, I just added a bunch of scopes that seemed somewhat relevant to me):

Once you have connected n8n with your Microsoft account, you can then run a workflow like this to fetch your contacts:

I’ve just tested this on my side and it seems to work fine:

Hope this helps :slight_smile:

@MutedJam Hello, thanks, it was very helpful.
Now my account is connected, but when I try to run the node the output return me this:

Can you share your HTTP Request node? Simply select it on your n8n canvas and paste it here on the forum.

The flow have the request like /me/, but actually is /me/contacts, like you and like graph say
And with this url, return me the error

For me the issue is in the authorization, azure side, maybe i am wrong

Hm, the node seems to be working fine for me and the “cause” information you have shared doesn’t seem to refer to an HTTP response. If you enable the Full Response + Ignore Response Code options, do you get any additional information on the error?

When opening your credentials, can you confirm if you see the “Account connected” message at the top and which scopes you are currently using?



Also, which version of n8n you are currently using and how you have it deployed (desktop, docker, n8n cloud, etc.)?

I have tried with Full Response + Ignore Response Code options but the output is:

Unauthorized 401

-Yes, when i open the credentials i can see “Account connected”
-I am using online version 0.190.0

So this does look like a Microsoft error after all. The error message suggests a problem with your authentication as you suspected. What does the full error message say? It’s unfortunately cut off on your screen shot. Are you perhaps trying to connect an account that doesn’t have permission to read your Azure AD/Exchange Online data?

  "body": {
    "error": {
      "code": "OrganizationFromTenantGuidNotFound",
      "message": "The tenant for tenant guid 'a8c7cc9e-c723-421c-a0cf-85b8e2707c14' does not exist.",
      "innerError": {
        "oAuthEventOperationId": "d22d84d0-24a5-4a9e-8229-d143b937e3c1",
        "oAuthEventcV": "Y4f75jNccA4BVlVuWMajKg.1.1",
        "errorUrl": "",
        "requestId": "25fba016-0065-4cde-ac46-51c7fafba0f4",
        "date": "2022-09-01T09:36:36"
  "headers": {
    "cache-control": "private",
    "transfer-encoding": "chunked",
    "content-type": "text/html; charset=utf-8",
    "strict-transport-security": "max-age=31536000",
    "request-id": "25fba016-0065-4cde-ac46-51c7fafba0f4",
    "client-request-id": "25fba016-0065-4cde-ac46-51c7fafba0f4",
    "x-ms-ags-diagnostic": "{\"ServerInfo\":{\"DataCenter\":\"Germany West Central\",\"Slice\":\"E\",\"Ring\":\"5\",\"ScaleUnit\":\"001\",\"RoleInstance\":\"FR2PEPF000001ED\"}}",
    "date": "Thu, 01 Sep 2022 09:36:35 GMT",
    "connection": "close"
  "statusCode": 401,
  "statusMessage": "Unauthorized"

Hm, I can’t open the errorUrl so can’t tell you exactly what the problem is. Have you connected your OAuth2 credentials with a company/school account or did you perhaps use a private Microsoft account by accident?