Invite Guest User via Graph API not checking for valid email

Sylvie Letourneau 1 Reputation point
2022-08-05T14:15:49.643+00:00

I have been using Microsoft Graph APIs to invite guest users to the tenant.
This works fine for valid email addresses, and there seems to be error handling for obvious invalid ones like "person@"
But there is no error handling for more subtle invalid addresses like "person@gamillllllll.c"

If I use the API to create "person@gamillllllll.c" it actually sends the invite and creates the account it even adds the account to a security group.
So even though the mailbox does not exist, it creates the account. This means there are dead accounts through our tenant, and the guest users we tried to invite never received an invite because the email was invalid. There should be some kind of error handling to deal with this. I thought previously that guest accounts weren't actually created until the user signed in once. You couldn't add them to a security group until the account was validated by being used one time.

Is there any work around to this/any planned changes?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,521 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. CarlZhao-MSFT 36,736 Reputation points
    2022-08-08T10:15:50.913+00:00

    Hi @Sylvie Letourneau

    Sign in to the Azure portal as a global administrator > Azure AD > User settings > External collaboration settings > Collaboration restrictions and select Deny invitations to the specified domains or Allow invitations only to the specified domains (most restrictive). This way there will be a layer of filter mechanism when you invite collaboration accounts.

    229098-2022-08-08-181247.png


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. Julio Muñoz 0 Reputation points
    2023-05-09T22:30:11.8+00:00

    Thanks but the problem still exists

    0 comments No comments