What is the max length of a graph api filter?

Brent Arias 36 Reputation points
2021-11-12T23:59:29.637+00:00

In my .Net Core C# code, I would like to make a query like this:

users = await usersRequest
    .Filter("Mail in ('******@extra.com', '******@extra.com', '******@bigdomain.com')")
    .GetAsync(cancellationToken);

The filter in this example is only about 67 characters long, and yet I'd like to add dozens (hundreds?) more mail addresses into the query. If I keep adding more values into this query, assuredly I will run into some max-length limitation. What is that max length?

Are these query parameters set as part of the URI query string? If yes, I understand that the entire URI has a "de facto" limit of 2000 characters. If true, then I somehow need to fit everything into that limit.

I'm also aware that there is an alternate way to specify query info...through "query options". However, its the same question. Are those query options stored in the REST body, or in the query string? If they are stored in the body, is there a max length?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,992 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.