在 .NET 应用程序中使用 .Filter() 中的多个过滤器和 GraphServiceClient
Using multiple filters in .Filter() with GraphServiceClient in .NET application
我无法合并过滤器。当我尝试这样做时,Graph 出现错误。举例如下:
这个有效:
var users = await client.Users
.Request()
.Filter($"userType eq 'Member'")
.Select(u => new
{
u.DisplayName,
u.UserType,
u.SignInActivity,
})
.GetAsync();
这也有效:
var users = await client.Users
.Request()
.Filter($"signInActivity/lastSignInDateTime le 2021-11-01T00:00:00Z")
.Select(u => new
{
u.DisplayName,
u.UserType,
u.SignInActivity,
})
.GetAsync();
但是,如果我合并过滤器,它不会:
var user = await client.Users
.Request()
.Filter($"userType eq 'Member' and signInActivity/lastSignInDateTime le 2021-11-01T00:00:00Z")
.Select(u => new
{
u.DisplayName,
u.UserType,
u.SignInActivity,
})
.GetAsync();
我收到错误 Filter not supported.
。我错过了什么?
根据 documentation signInActivity
属性 支持 $filter
但不支持任何其他可过滤属性。
Returned only on $select. Supports $filter (eq, ne, not, ge, le) but, not with any other filterable properties. Note: Details for this property require an Azure AD Premium P1/P2 license and the AuditLog.Read.All permission.
我无法合并过滤器。当我尝试这样做时,Graph 出现错误。举例如下:
这个有效:
var users = await client.Users
.Request()
.Filter($"userType eq 'Member'")
.Select(u => new
{
u.DisplayName,
u.UserType,
u.SignInActivity,
})
.GetAsync();
这也有效:
var users = await client.Users
.Request()
.Filter($"signInActivity/lastSignInDateTime le 2021-11-01T00:00:00Z")
.Select(u => new
{
u.DisplayName,
u.UserType,
u.SignInActivity,
})
.GetAsync();
但是,如果我合并过滤器,它不会:
var user = await client.Users
.Request()
.Filter($"userType eq 'Member' and signInActivity/lastSignInDateTime le 2021-11-01T00:00:00Z")
.Select(u => new
{
u.DisplayName,
u.UserType,
u.SignInActivity,
})
.GetAsync();
我收到错误 Filter not supported.
。我错过了什么?
根据 documentation signInActivity
属性 支持 $filter
但不支持任何其他可过滤属性。
Returned only on $select. Supports $filter (eq, ne, not, ge, le) but, not with any other filterable properties. Note: Details for this property require an Azure AD Premium P1/P2 license and the AuditLog.Read.All permission.