graph api url calling work in the explorer but doesnt with python script calls Error: 404,

Brosk 0 Reputation points
2023-11-23T16:25:31.23+00:00

i am using microsoft graph explorer to call this url :
https://graph.microsoft.com/v1.0/users/******@outlook.com/messages
which return all the messages and everything is fine.
but when I use the URL call in my Python script i get :
Error: 404, Details: {"error":{"code":"ErrorInvalidUser","message":"The requested user '******@outlook.com' is invalid."}}

this is a personal email btw
I tried the api on my work email everything was fine but now that I created this account something gone wrong.
I changed the tenant ID to "common" but still facing the same issue

Microsoft Security Microsoft Graph
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. AsithwMSFT 1,445 Reputation points Microsoft External Staff
    2023-11-26T01:46:51.39+00:00

    It might be because the Python script wasn't focused on the correct scope (Mail.Send)

    did you ensure the correct scope was granted?

    try decoding access token and check the scope value,

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.