I'm new to SPFX and still trying to find my way around. At the moment I'm struggling to access particular fields from site pages using REST. I realize this is a n00b request, but any help would be apppreciated.
The current requirement is to create a simple web part that will go onto the intranet landing page. It takes a single page URL as a property, validate that the URL uses a specific custom content type, and then display the article date, content type, comments, rollup image and a 'Read more' button linking to the page from the url property.
My current approach is roughly:
export interface ISPList {
Id: string;
Url: any;
PublishingRollupImage: any;
}
and
private _getListData(): Promise<ISPLists> {
return this.context.spHttpClient.get(this.context.pageContext.web.absoluteUrl + `/_api/web/lists/GetByTitle('Pages')/Items`, SPHttpClient.configurations.v1).then((response: SPHttpClientResponse) => {
debugger;
return response.json();
});
}
This works for the most part, but doesn't include values for the rollup image or url to the page represented by a given listitem. Suggestions on accessing the fields mentioned, please?