-
Notifications
You must be signed in to change notification settings - Fork 419
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
400 Client Error: Bad Request for url: https://graph.microsoft.com/v1.0/sendMail | Error Message: Resource not found for thesegment 'sendMail'. #418
Comments
You are overwriting the variable 'm' and also not setting the resource for the message. Also, you can generate a new message from the mailbox so you don't have to specify the resource every time.
Between the above calls, you should always call: if not account.is_authenticated:
account.authenticate() |
@janscas I have a similar code and getting the same bad request url error:
I noticed the api calls a url: "https://graph.microsoft.com/v1.0/sendMail" but shouldn't it be "https://graph.microsoft.com/Mail.Send" ? I am able to do everything else except for sending an email. Am I missing a step or misunderstanding something? |
@yegorsb when using “credentials” flow type the api doesn’t know what account to send from.. You are just logged in as “the app”. provide a resource to mailbox and proceed. like: you will of course need to have access to that account. |
@janscas Thank you!
Forgive me for I am new to the configuring things on the back end. Thank you! |
If your account has access to a certain address and you're the creator of the app it should work. I'm not very deep into azure app registration so i can't really tell |
For anyone struggling with this issue, you may find it helpful to know this: If you are using the client credentials grant flow (a.k.a. "Authenticate with your own identity"), and if the account you wish to use as the resource mailbox has been brought into your tenant as a Guest account, it will not work. This approach is not supported. I learned the hard way. Sources cited: |
Didn’t know. Very useful! thanks |
I've been trying to get the following piece of code working but have been receiving the errors above. I looked into the other issue here related to this error but coulnd't solve it. Would appreciate any tips on this. Thanks. I've attached the logs below and my permissions are also correct in the azure panel.
The text was updated successfully, but these errors were encountered: