Ignore sub folder in path selector

Novice User asked on June 13, 2018 17:56

In a web part I have a Path Selector, When I create a document query from this path, It also includes sub folders as well. How do I ignore the sub folder or can customize the nesting level?

Correct Answer

Peter Mogilnitski answered on June 13, 2018 18:03

// Get news items from /News section except the Archive sub-section
var news = DocumentHelper.GetDocuments("CMS.News")
                              .ExcludePath("/News/Archive", PathTypeEnum.Section);

for all sub-folders the exclude path should be .ExcludePath("/News/%/%", PathTypeEnum.Section)

0 votesVote for this answer Unmark Correct answer

   Please, sign in to be able to submit a new answer.