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

1 answer

Sort by: Most helpful
  1. Emily Du-MSFT 41,616 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.