0

I'm trying to use the search rest api to get all site pages from a site page library with a content type of "site page" and not news links (repost page). "Content type" is a field in a site page library but filtering on it doesn't work in a rest call. This also doesn't work:

/_api/search/query?querytext='ContentType:Site%20Page AND IsDocument:True AND FileExtension:aspx AND PromotedState:2 Path:https://xxx.sharepoint.com/sites/xxx' 

Oddly though, if I enter ContentType:Site%20Page in the generic search box I get ONE result - it is a site page but there are hundreds more not returned. And ContentTypeID doesn't work either. I've tried various other configurations of the url ($filter, $select) and many different options in threads here, and also the managed property SPContentType, but none have worked.

I've also checked as many Msft documents as I can find but they are so poorly written and inconclusive, they haven't helped.

By the way, in the highlighted content web part, I can select SPContentType as a managed property and it filters on "Site Page" correctly....

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.