1

I have a working REST query that grabs all News Posts and News Links. Since the former is considered 'Internal' news, I need a query that can grab these two types of news separately.

https://tenanturl.sharepoint.com/sites/intranet/_api/web/lists/getbytitle('Site%20Pages')/items?$filter=PromotedState%20eq%202&$select=Title,file/ServerRelativeUrl,BannerImageUrl,Modified,Description&$expand=file&$orderby=Created%20desc

I see in the Site Pages settings that there are 2 content types:

enter image description here

Can I use the content type within the REST query to split the News results apart? I also notice the _OriginalSourceURL is populated for News Links (External), but any attempt to use that in a REST query filter says it doesn't exist:

Column '_OriginalSourceUrl' does not exist. It may have been deleted by another user.

1 Answer 1

0

You can provide a filter on the Content Type like this:

https://tenanturl.sharepoint.com/sites/intranet/_api/web/lists/getbytitle('Site Pages')/items?$filter=PromotedState eq 2 and ContentType eq 'Repost Page'&$select=Title,file/ServerRelativeUrl,BannerImageUrl,Modified,Description&$expand=file&$orderby=Created desc

The key portion above being the ContentType eq 'Repost Page'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.