Azure / O365 / POST to https://graph.microsoft.com/v1.0/users/<userid>/sendMail: "The tenant for tenant guid '<guid string>' does not exist."

paulrichards-2625 26 Reputation points
2023-10-05T19:46:09.89+00:00

Hello, I have an O365 Family License and a background service (win64 C++ process) that is using oauth2.0 to get a token with a client secret. I'm using the Azure Free Service with my tenant id and found that the error message I'm getting when I post to https://graph.microsoft.com/v1.0/users/<myuserid>/sendMail (REST API) typically indicate there is no O365 license. The error message that I am getting back is "The tenant for tenant guid '<guid string>' does not exist."

Do I need to sign up for an additional azure or O365 subscription? The Azure service I setup does have both sendMail as a delegated user and application permission to sendMail as any user granted for the default directory. (See screenshot)Capture2023-10-05

Better yet, is there a way to use a client secret and get a token for a personal delegated process with a single school/work/personal account? I find if I use the auth flow (https://login.microsoftonline.com/common/oauth2/v2.0/authorize) during the process it returns a url that requires javascript and user interaction (need to login with browser). Is there a way to avoid user interaction and just keep using something like a client secret with an individual school/personal account to get tokens after I have consent to give the application permissions to send email? (Again, I have been able to successfully send an email through https://graph.microsoft.com/v1.0/me/sendMail but the auth part of it requires user browser interaction including javascript.)

Basically I have C++ process that does some work with git but if it fails I want it to send an email from my account. SMTP/POP3 is not an option.

Microsoft Exchange Online
Office
Office
A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.
1,479 questions
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,446 questions
{count} votes