gpt4 book ai didi

c# - 使用别名地址过滤用户 - MS Graph

转载 作者:行者123 更新时间:2023-12-03 05:27:49 32 4
gpt4 key购买 nike

我们如何使用别名邮件地址而不是实际的用户主体名称来过滤用户。就像下面这样

GraphServiceClient graphClient = new GraphServiceClient( authProvider );

var user = await graphClient.Users
.Request()
.Filter("UserPrincipalName eq '<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="43222222032222226d202c2e" rel="noreferrer noopener nofollow">[email protected]</a>'")
.GetAsync();

现在,当我使用别名地址时,出现“未找到”错误。

感谢任何帮助。

最佳答案

UserPrincipalName 的一般格式是 alias@domain,其中域必须存在于租户的已验证域集合中。

当电子邮件地址填充为备用电子邮件时搜索用户:

otherMails 包含用户的其他电子邮件地址列表;例如:[“[email protected]”,“[email protected]”]。

.Filter($"otherMails/any(id:id eq '<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6c191f091e2c09140d011c0009420f0301" rel="noreferrer noopener nofollow">[email protected]</a>'")

当电子邮件地址填充为登录名时搜索用户:

.Filter($"identities/any(id:id/issuerAssignedId eq '<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="9eebedfbecdefbe6fff3eef2fbb0fdf1f3" rel="noreferrer noopener nofollow">[email protected]</a>' and id/issuer eq 'contoso.onmicrosoft.com')")

有关个人电子邮件地址的更多信息,请参阅 here .

<小时/>

如果您指的别名地址是带有 SMTP 的地址,例如:["SMTP: [email protected] ", "smtp: [email protected] "]。您可以使用proxyAddresses,“smtp”是必需的。

https://graph.microsoft.com/v1.0/users?$filter=proxyAddresses/any(c:c eq 'smtp:<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="14757575547575753a777b79" rel="noreferrer noopener nofollow">[email protected]</a>') 

.Filter($"proxyAddresses/any(c:c eq 'smtp:<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="adccccccedcccccc83cec2c0" rel="noreferrer noopener nofollow">[email protected]</a>'")

关于c# - 使用别名地址过滤用户 - MS Graph,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67477350/

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