Try our conversational search powered by Generative AI!

Is It possible to specify the start page in the Epi Server CMS Find query instead of entire project search.


Hi Team, I would like to get the all the pages start with alphabets letters(Title Start with A,B,C..Z) under specific parent page using Epi Server Cms find query. Can anybody familier same kind of functionality?. 

Jul 19, 2018 9:22

Hello, After having a look, the query would look something like this:

internal Injected<IClient> FindClientService { get; set; }
var sitePages = FindClientService.Service.Search<PageData>()
    .Filter(page => page.ParentLink.Match(parentReference))
    .Filter(page => page.Name.PrefixCaseInsensitive("A") | page.Name.PrefixCaseInsensitive("b"))
    .OrderBy(page => page.Name)

You would send the reference for the parent page into the query and then you could then put the characters into the 2nd filter method in the PrefixCaseInsensitive method. The above example would return pages that are children of a specific page. The second filter would then return if any of the pages Name begins with A or B (no matter if they are uppercase or lowercase).

Hope this helps!

Edited, Jul 19, 2018 10:46

Thank you for your quick response Steven, However i am able to get only 1'st root child pages and not able to get Child's Child pages(descendant) . Hope you understand.

Jul 19, 2018 11:23

Ok, I get what you mean now. I shall have to have a look and see how to do that. Will get back to you if I can figure it out smile

Jul 19, 2018 11:31

You may be able to use the Ancestors extensio to search where the ancestor is the page root. This has been discussed here:

Jul 19, 2018 14:57

Thank you David Knipe You saved my time today. Its perfectly working for Pages , But For Blocks also we need smile .

Jul 20, 2018 11:06

Do you want to find blocks that are on pages or blocks where they are in the tree?

Jul 20, 2018 12:13

Irrespective of all the down blocks in the tree(for given parent). Hope you understand.  

Jul 20, 2018 12:21

If you are looking for blocks within certain places within the tree then the Ancestors method should could work, use the content reference of the folder that the block(s) sit in.

Jul 20, 2018 15:35

Yes David Knipe Thanks again. Its similar but thing is i will pass the page content link  and needs to get the all blocks which is created using the block type(Specific document list block) in the same page and child pages as well.

I am trying to write below for blocks:

var client = SearchClient.Instance;
var query = client.Search<DocumentListBlock>()
// .Filter(x => x.Ancestors().Match(startPage.ToReferenceWithoutVersion().ToString())) ----- Need to get the used blocks under the specified start page 
.Filter(page => page.Title.PrefixCaseInsensitive("abc")).Take(1000);
var batch = query.GetContentResult();

I am not able to find the Ancestors method for blocks.

Jul 24, 2018 10:59
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.