Forum Discussion

NickMumby's avatar
NickMumby
Copper Contributor
Nov 07, 2024

get "First Published Date" through graph api lists

I have a number of SharePoint sites that publish news articles. One of the Key fields is "First Published Date". Which shows if the article is published or still in draft. 

I'm using 

GET https://graph.microsoft.com/v1.0/sites/{siteId}/pages$filter=promotionKind eq 'newsPost'

which returns all the news pages in a site. 

there is an additional field called first published date I can see in the library. And I can see it using 

GET /sites/{site-id}/lists/{list-id}/columns



        {
            "columnGroup": "_Hidden",
            "description": "",
            "displayName": "First Published Date",
            "enforceUniqueValues": false,
            "hidden": false,
            "id": "c84f8697-331e-457d-884a-c4fb8f30ea74",
            "indexed": true,
            "name": "FirstPublishedDate",
            "readOnly": true,
            "required": false,
            "dateTime": {
                "displayAs": "default",
                "format": "dateTime"
            }
        },


But this column isn't returned using the sites/pages get request. I have also tried to force it to show by using 

$select=FirstPublishedDate

but I get the error

{
    "error": {
        "code": "BadRequest",
        "message": "Parsing OData Select and Expand failed: Could not find a property named 'FirstPublishedDate' on type 'microsoft.graph.baseSitePage'.",
        "innerError": {
            "date": "2024-11-07T13:30:16",
            "request-id": "1ba721f9-7ae0-43ab-8fe1-89a598245c02",
            "client-request-id": "a2fd61e8-c652-6b22-ea3f-037655568ddf"
        }
    }
}

 

 

how can I get the value of this field for a page?

No RepliesBe the first to reply

Resources