You could use the Graph in order to create B2B users without invitation.
Reference : https://docs.microsoft.com/en-us/graph/api/resources/invitation?view=graph-rest-1.0
POST https://graph.microsoft.com/v1.0/invitations
{
"invitedUserEmailAddress": "[email protected]",
"inviteRedirectUrl": "https://sample.com",
"sendInvitationMessage": false,
}
You could probably experiment the same action and see whether it meets your requirement in the graph explorer :
https://developer.microsoft.com/en-us/graph/graph-explorer
Having said that, Now you can use the GRAPH C# SDK in order to achieve your requirement using the above request
Ref:https://docs.microsoft.com/en-us/graph/sdks/sdks-overview
To add a External user without the email using GraphClient using C# would be like below :
public static void CreateB2BUser()
{
try
{
var invitation = new Invitation
{
SendInvitationMessage = false,
InvitedUserEmailAddress = "[email protected]",
InvitedUserType = "Member",
InviteRedirectUrl = "https://sampledomain.com",
InvitedUserDisplayName = "Sample User",
};
graphClient.Invitations.Request().AddAsync(invitation);
}
catch (ServiceException ex)
{
Console.WriteLine($"Error Creating User : {ex.Message}")
}
}
This article can help you to get a quickstart with the authentication and creation of the GraphClient.