$filter not applying to sitePages in beta branch

Maximilian Gillmann 0 Reputation points
2024-04-03T13:34:45.3566667+00:00

Hey there,

I'm currently trying to get all news posts from a SharePoint site via Graph. AFAIK this is currently only possible using the beta branch. What I noticed was that the filter query seems to get ignored in my cases.

This is my request:

https://graph.microsoft.com/beta/sites/SITE_ID/pages/microsoft.graph.sitePage?$select=promotionKind&$filter=promotionKind eq 'newsPost'

This the response:

    { "@odata.context": "https://graph.microsoft.com/beta/$metadata#sites('SITE_ID')/pages/microsoft.graph.sitePage(promotionKind)",
    "value": [
        {
            "promotionKind": "newsPost"
        },
        {
            "promotionKind": "newsPost"
        },
        {
            "promotionKind": "page"
        },
        {
            "promotionKind": "page"
        },
        {
            "promotionKind": "page"
        },
        {
            "promotionKind": "page"
        },
        {
            "promotionKind": "page"
        }
    ]
}

Now my question would be: Am I doing something wrong? What am I missing?

Thanks in advance!

Max

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
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,300 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Emily Du-MSFT 44,311 Reputation points Microsoft Vendor
    2024-04-05T08:53:25.52+00:00

    You do not need to add $select=promotionKind parament in the query.

    Please use following query in the Graph API.

    https://graph.microsoft.com/beta/sites/SITE_ID/pages/microsoft.graph.sitePage?$filter=promotionKind eq 'newsPost'
    

    enter image description here


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

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. Maximilian Gillmann 0 Reputation points
    2024-05-20T11:10:07.8033333+00:00

    Quick update here: I've got feedback regarding the issue from the tech team.

    According to this: https://learn.microsoft.com/en-us/graph/api/sitepage-get?view=graph-rest-beta&tabs=http#optional-query-parameters filtering is not possible (anymore). I'm pretty sure it worked in the past.

    My solution is now to filter on my side in order to achieve what I need.

    0 comments No comments