graph API filter being ignored

Nick Mumby 0 Reputation points
2024-04-24T08:35:49.4233333+00:00

I have a flow that returns a list of all site pages using the graph api. I've been trying to add a date filter, but it seems to be completely ignored when running the GET request.  I've tried to simplify it as much as possible and it seems I can't get any type of filter to work.

Below you can see there is a filter for name to equal test. But it seems to be completely ignored. The first item returned name ios 'Home.aspx'

What am I doing wrong?

nick9one1_0-1713887918086.png

https://graph.microsoft.com/beta/sites/<site id>/pages/microsoft.graph.sitePage?$filter=name eq 'test'				
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,449 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. CarlZhao-MSFT 40,311 Reputation points
    2024-04-25T09:02:43.56+00:00

    Hi @Nick Mumby

    According to my testing, it should not yet support using the $filter query parameter to filter site pages by name.

    I recommend you to get the target page by looping through the page set. Here is an example:

    var pages = await graphClient.Sites["{site_id}"].Pages.GetAsync();
    
    foreach (var page in pages.Value)
    {
        if (page.Name is "test") {
    
            Console.WriteLine(JsonConvert.SerializeObject(page));
        }
    }
    

    Hope this helps.

    If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.

    0 comments No comments