Hi everyone! I’m trying to set up a workflow in n8n that pulls contact information from our Exchange server. What I need to do is extract basic contact details like email addresses, first names, and last names, then store all this data in a database.
I’ve been looking into this and found out that I need to use Microsoft Graph API for this task. Specifically, I think I should be making calls to:
https://graph.microsoft.com/v1.0/me/contacts
Has anyone successfully connected Exchange to n8n before? I’m wondering about the best approach to authenticate and pull this contact data into my n8n workflow. Any tips on setting up the API connection or handling the response data would be really helpful.
I did Exchange integration in n8n about six months ago for something similar. Microsoft Graph API is definitely the way to go, but there are some gotchas that’ll save you headaches. You need to register an app in Azure Active Directory and set up Contacts.Read permissions. The auth flow’s tricky - I just used n8n’s OAuth2 credentials instead of handling tokens myself. Pagination caught me off guard. Exchange contact lists get huge, so Graph returns results in batches. You’ll need to handle the @odata.nextLink property to grab all contacts. I built a loop in my workflow that keeps fetching until there’s no more pages. Also, the data structure’s inconsistent. Lots of contacts have missing info, so make sure your workflow handles empty fields. Test with a small batch first before hitting your whole contact database.
Graph API works well but handle rate limiting properly. Microsoft throttles requests hard, especially for contacts. I hit 429 errors constantly until I added delays between calls. Use exponential backoff in your n8n workflow. Watch out for contact data format - Exchange stores phone numbers and addresses in arrays, so parse those carefully before your database insert. I create a separate node that normalizes contact data structure first. Use the $select query parameter to only fetch fields you need. This speeds up API responses big time with large contact lists. The default response includes tons of metadata you don’t need.
azure app registration trips ppl up initially, but its simple once u got the client ID and secret configured. make sure ur redirect URI matches ur n8n instance exactly - otherwise auth breaks. i always test graph API calls in postman before buildin the actual n8n workflow.