3

While searching the solution I found How would I get all pages using core service? where it get list of SG while providing publication URI as RepositoryItemsFilterData . I am trying to use it to get the list of pages in an SG. However when I give SG TCM ID as RepositoryItemsFilterData core service gives me error 'Unexpected item type: StructureGroup.' I am writing code something like below. Can someone help to me on how to get pages when you have SG TCMID.

    public List<string> PagesToRemove(string structureGroupTCMID)
               {

                        var itemTypes = new List<ItemType>();
                        itemTypes.Add(ItemType.Page);    
                        var filter = new RepositoryItemsFilterData();
                        filter.Recursive=true;                
                        filter.ItemTypes = itemTypes.ToArray();    
                        var listXml =_CoreServiceClient.GetList(structureGroupTCMID, filter);
                        List<string> lstPageTCMID = new List<string>();
                       //code to map listXml to lstPageTCMID
                        return lstPageTCMID;
                    }

1 Answer 1

6

Instead of using RepositoryItemsFilterData, you should use OrganizationalItemItemsFilterData.

You can use following code to filter the pages from a structured group:

       _CoreServiceClient.GetListXml(structureGroupTCMID, new OrganizationalItemItemsFilterData
        {
            ItemTypes = new[] { ItemType.Page },
            Recursive = true,
            BaseColumns = ListBaseColumns.Default
        });

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.