【发布时间】:2020-09-29 06:58:03
【问题描述】:
我正在将用户添加到 AAD,然后将用户添加到组。但是,在我们添加用户之前好像有一个小的延迟。是预期的行为吗?如果是,您预计会延迟多长时间?
在下面的代码中,将用户添加到组失败,因为用户为空。几秒钟后,我可以添加它。为了实现这一点,我需要知道预期的延迟是多少。可以是几分钟还是几小时?
var email = "xxx";
var graphClient = await Graph.GraphServiceClientExtension.GetGraphClient( _config.AzureAppIdExternal, _config.AzureAppSecretExternal, _config.TenantNameExternal);
var invite = new Microsoft.Graph.Invitation();
invite.InvitedUserEmailAddress = email;
invite.InvitedUserDisplayName = email;
invite.InviteRedirectUrl = "xxx";
invite.SendInvitationMessage = true;
var inviteMsgInfo = new Microsoft.Graph.InvitedUserMessageInfo();
inviteMsgInfo.CustomizedMessageBody = "Velkommen, xx";
invite.InvitedUserMessageInfo = inviteMsgInfo;
var inviteUserResponse = await graphClient.Invitations.Request().AddAsync(invite);
var user = (await graphClient.Users.Request().Filter($"mail eq '{email}'").GetAsync()).FirstOrDefault();
await graphClient.Groups["xx-7b17-4ed7-9b75-xx"].Members.References.Request().AddAsync(user);
【问题讨论】:
标签: azure-active-directory microsoft-graph-api microsoft-graph-sdks