0

I am trying to make a HTTP request from a client(n8n) to microsoft Graph, the url is: https://graph.microsoft.com/v1.0/me/contacts and when i execute this one, the output return me this:

"ResourceNotFound","message": "Resource could not be discovered"
404 Not Found

But if i execute the url without /contacts/ works fine. So, I ve read online, that maybe is something related to Microsoft 365. Do you have more info about this error??

  • This is the list contact api [document](https://learn.microsoft.com/en-us/graph/api/user-list-contacts?view=graph-rest-1.0&tabs=http). Since you mentioned that `https://graph.microsoft.com/v1.0/me` worked fine for you, so I trust you've got a correct delegate access token. But I'm not sure if you had set the correct scope . Could you pls check if you had added `Contacts.ReadWrite` api permission? or decode the access token you used to check if this scope existed in the `scp` claim. – Tiny Wang Sep 07 '22 at 02:10
  • by the way, I also agree with you that it may relate to M365 account. This api will get a contact collection from the default contacts folder of the signed-in user. So you must have the contacts folder first. – Tiny Wang Sep 07 '22 at 02:12
  • hi @TinyWang, Thanks for replying. The scope is this:https://graph.microsoft.com/.default, but it's not working with Contacts.ReadWrite. – Gabriele Bracciali Sep 08 '22 at 07:30
  • `graph.microsoft.com/.default` is for application permission, but now you're using `/v1.0/me` so the scope should be `Contacts.ReadWrite`. when you are using `/.default`, pls change the api url to `https://graph.microsoft.com/v1.0/users/user_id/contacts ` – Tiny Wang Sep 08 '22 at 07:34
  • @TinyWang okay, I've tried with that url, and the output return me: InvalidAuthenticationToken", "message": "Access token has expired or is not yet valid 401 Unauthorized – Gabriele Bracciali Sep 08 '22 at 09:03
  • pls take a look at [this answer](https://stackoverflow.com/a/70516040/15581227), it explain the difference between `/me` and `/user/userid`, and when use `/.default` we need to use client credential flow. – Tiny Wang Sep 08 '22 at 09:43

0 Answers0