Making A Custom HTTP OAuth 2 Request to Microsoft Graph

What I’m attempting to do is communicate via the HTTP “Make A Request” module with Microsoft Graph API—specifically the mail endpoint.

But if you know an easier way…

Seriously if you do please tell me.

And I hear you saying “Why not just use the Microsoft 365 Email Module’s Make an API Call?”

Fantastic question!

The reason is, whoever made the Microsoft 365 Email app neglected to follow Make.com documentation and allow for custom scopes to be requested when you create a connection.

Automation breaking in my case as I need access to ALL users and the app is only scoped for the signed in user

Back to my question…

I don’t have a problem creating a token and passing that to another step that needs it in the Header.

However…

When I run that second HTTP “Make A Request” it just sits and spins

I would wait to see how long but I’m not that patient

I receive no error or response.

I’ve uploaded three photos showing my inputs into the module and the dev tool to demonstrate that it sent two requests after sitting and spinning for a bit of time with no response.

It should be noted that other end points like “/users” will return my M365 users no problem.

But this one will not fall in line.

Let me know if you have any experience with this! Looking forward to getting past this hurdle lol



1 Like

Hello @Dominique_Karolczak and welcome to the Make Community!

I have a few questions here…

  1. Are you following the documentation here?
  2. If so, it says you need Mail.ReadWrite scope. When I look at my built-in Microsoft 365 Connection, I’ve got that scope.

image
Seems like the built-in module should work.

  1. Content-Length, in the documentation it says it should be 0. Where does the 400 come from?

Hey @Donald_Mitchell

What Make doesn’t tell you is that your Mail.ReadWrite permission is Delegated only. You do not have Application permission. That means you can only work with the signed-in user.

So I would have to sign into every user and create a custom little app for each to send as them…

But I don’t like asking for or knowing people’s passwords.

As for content length…

I discovered in Postman you don’t even have to put it in at all :joy:

Zero or the actual length doesn’t matter in their world.

FIXED!

For some reason, the email should be used vs. the user ID for Make.

Microsoft told me they don’t know why the ID wouldn’t work but here we are.

3 Likes

Ah, very good point! Glad you got it resolved!

2 Likes