I want to invite an user in our Active Directory/Tenant. For this using Micorosoft Graph API. Code is used as below
IConfidentialClientApplication confidentialClientApplication = ConfidentialClientApplicationBuilder
.Create(clientId)
.WithTenantId(tenantID)
.WithClientSecret(clientSecret)
.Build();
ClientCredentialProvider authProvider = new ClientCredentialProvider(confidentialClientApplication);
GraphServiceClient graphClient = new GraphServiceClient(authProvider);
var invitation = new Invitation
{
InvitedUserEmailAddress = "[email protected]",
InviteRedirectUrl = "https://myapp.com"
};
await graphClient.Invitations
.Request()
.AddAsync(invitation);
After this, I can see the user in Azure's Active directory portal. But don't get an invitation email.
However, when I click on Resend Invite from Azure Portal then the invite email is coming.
Can you please guide, why the invite email is not coming when sending invite from API?