我们正在使用azure b2b邀请外部用户访问租户中的应用程序。邀请
对于新用户,我们将在接受用户访问应用程序后发送b2b邀请(使用带有自定义邮件格式的c#代码)。
对于不向用户发送电子邮件的批量用户,天蓝色中有一个选项,即下载excel模板并使用[ sendEmail ]列值填充excel中的详细信息或否
现在,我想在不使用C#代码发送电子邮件的情况下将用户添加到天蓝色的广告中。有人可以建议达到要求吗?
答案 0 :(得分:2)
您可以使用Graph来创建B2B用户,而无需邀请。
参考:https://docs.microsoft.com/en-us/graph/api/resources/invitation?view=graph-rest-1.0
POST https://graph.microsoft.com/v1.0/invitations
{
"invitedUserEmailAddress": "guestuser@sampledomain.com",
"inviteRedirectUrl": "https://sample.com",
"sendInvitationMessage": false,
}
您可能可以尝试相同的操作,然后在图形浏览器中查看它是否满足您的要求: https://developer.microsoft.com/en-us/graph/graph-explorer
话虽如此,现在您可以使用GRAPH C#SDK来满足上述要求
参考:https://docs.microsoft.com/en-us/graph/sdks/sdks-overview
要使用C#使用GraphClient添加不带电子邮件的外部用户,如下所示:
public static void CreateB2BUser()
{
try
{
var invitation = new Invitation
{
SendInvitationMessage = false,
InvitedUserEmailAddress = "user@sample.com",
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可以帮助您快速进行GraphClient的身份验证和创建。