3

Do you know if there is any way to get list of all published pages for specific publication by using Content Delivery API?

Something similar to next API, but for pages:

new PublicationMetaFactory().getAllMeta();
6

Here is the working code example for getting the published pages items:

    int publicationId = 8; //change this value to your publicationId on your environment   
    PublicationCriteria publicationCiteria = new PublicationCriteria(publicationId);
    ItemTypeCriteria itemCriteria = new ItemTypeCriteria(64);
    Query query = new Query(CriteriaFactory.And(new Criteria[] { publicationCiteria, itemCriteria }));
    SortParameter sortParameter = new SortParameter(SortParameter.ItemLastPublishedDate, SortParameter.Descending);
    query.AddSorting(sortParameter);
    string[] itemIds = query.ExecuteQuery();

I hope it helps.

  • Right, we need to use Query object. Thanks! – Stan Kroshchenko Jan 30 '18 at 20:24
4

Haven't tested this, but I would probably use a Query object with its Criteria property set accordingly.

Meaning:

  • PublicationCriteria to select the desired publication
  • ItemTypeCriteria to select only pages.

Make sure to "And" these two criteria together. Once you have the criteria, you would simply call ExecuteQuery on the Query object and it will return the list of Tcm-s. Since this is the CD we're talking about, you will only get the Items present there, in other words, only the published ones.

Your Answer

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

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