Microsoft Graph API-为扩展属性生成过滤器查询 [英] Microsoft Graph API - generate the filter query for the extension attribute

查看:96
本文介绍了Microsoft Graph API-为扩展属性生成过滤器查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Azure AD B2C中创建了一个名为 extensions_ {b2cextensionappid} _IsDemoAccount 的扩展程序/自定义属性,以将该用户标记为演示用户.

我已尝试创建过滤器查询,以使用dotnet核心API中的 GraphServiceClient 选择Azure AD B2C目录中的所有演示用户.但这不起作用.

  var结果=等待graphClient.Users.要求()//.Filter($"identities/any(c:c/issuerAssignedId eq'test2'and c/issuer eq'{config.Value.TenantId}')').Filter($"Extensions/any(c:c/{IsTemporaryAccount} eq true')").Expand(扩展名") 

是否可以为扩展属性生成过滤查询?我没有在Microsoft文档中找到任何示例.

请提供任何解决方案或参考来实现这一目标?

解决方案

下面的图形查询可帮助您基于自定义属性进行过滤.

https://graph.microsoft.com/v1.0/users?$filter=extension_ {b2cextensionappid} _IsDemoAccount eq'是'& $ select = extension_ {b2cextensionappid} _IsDemoAccount

您可以参考使用Microsoft Graph SDK进行API调用

I have create a extension/Custom attribute called extensions_{b2cextensionappid}_IsDemoAccount in the Azure AD B2C to flag the user is a demo user.

I have tried to create filter query to select all the demo users in the Azure AD B2C directory using GraphServiceClient in dotnet core API. But it is not working.

   var result = await graphClient.Users
            .Request()
            //.Filter($"identities/any(c:c/issuerAssignedId eq 'test2' and c/issuer eq '{config.Value.TenantId}')")
            .Filter($"Extensions/any(c:c/{IsTemporaryAccount} eq true')")
            .Expand("Extensions")

Is there any way to generate the filter query for the extension attribute? I did not find any samples in the Microsoft documentation.

Please provide any solutions or an reference to achieve this?

解决方案

The below Graph Query help you to filter based on the custom attribute.

https://graph.microsoft.com/v1.0/users?$filter=extension_{b2cextensionappid}_IsDemoAccount eq 'Yes'&$select=extension_{b2cextensionappid}_IsDemoAccount

You can refer Make API calls using the Microsoft Graph SDKs

这篇关于Microsoft Graph API-为扩展属性生成过滤器查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆