gpt4 book ai didi

Azure AD Graph API 无法可靠地告诉我 guest 用户是否已存在

转载 作者:行者123 更新时间:2023-12-03 02:19:02 24 4
gpt4 key购买 nike

在发送访客邀请(或做出其他决定)之前,我需要知道该电子邮件地址是否已被使用。现在看来我唯一的选择是通过过滤 /users 进行检查API邮寄$filter=mail eq '<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="64011c050914080124011c05091408014a070b09" rel="noreferrer noopener nofollow">[email protected]</a>'

但是,一旦发送邀请,我注意到有时需要 10 秒以上才能完成。因此,如果我事先发出另一个请求,我的代码将检查 if(user.exists()返回false这会导致代码中发生意外行为。因为从技术上讲,用户现在就在那里。但 API 不会立即返回我需要的结果。

可能的解决方案之一是将访客帐户的电子邮件转换为 UPN由Azure生成...我正在研究Powershell - Checking if an Azure AD guest already exists中引用的建议

有更好的解决办法吗?每换一次靠谱吗@符号为_并附加#EXT#这样我就可以通过用户的主要名称来搜索用户(我相信这会立即给我准确的答案)/users/{upn}

最佳答案

您引用的 PowerShell 脚本是您可以在代码中使用的可行解决方案。

if(user.exists() returns false which causes unexpected behavior incode.

确保用户正在搜索的内容在 Azure AD 中不再可用其原始电子邮件 ID,因为它已从 $email = "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b6dcd9ded8f6d3dbd7dfda98d5d9db" rel="noreferrer noopener nofollow">[email protected]</a>" 转换而来。至upn="john_gmail.com#EXT#tenant.onmicrosoft.com"当你邀请的时候。

因此,检查您的用户存在是基于 UPN,而不是基于原始电子邮件 ID。

您可以使用此 SO 中提供的 PowerShell 脚本的任何概念。首先替换@_并附加#EXT#@tenant.onmicrosoft.com 。然后根据UPN进行搜索。

关于Azure AD Graph API 无法可靠地告诉我 guest 用户是否已存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69774675/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com