Using multiple filters in .Filter() with GraphServiceClient in .NET application

I'm unable to combine filters. I get an error from Graph when I try to do so. Examples as below:

This works:

var users = await client.Users
                    .Request()
                    .Filter($"userType eq 'Member'")
                    .Select(u => new
                    {
                        u.DisplayName,
                        u.UserType,
                        u.SignInActivity,
                    })
                    .GetAsync();

This also works:

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();

However if I combine the filters, it does not:

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();

I get the error Filter not supported.. What am I missing?


Solution 1:

According to the documentation signInActivity property supports $filter but, not with any other filterable properties.

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.