I am a newibie in episerver. I have been learning and i am kind of stuck in a situation.
I need to read the content of each page or more over each links in epierver. I used getDescendent which gives me whole bunch of ID.
var contentLoader = ServiceLocator.Current.GetInstance();
I could manupulate the output to get the desired content but it fails when the code finds a folder of type contentfolder as below
EPiServer.Core.TypeMismatchException: Content with id '1012' is of type 'EPiServer.Core.ContentFolder' which does not inherit required type 'EPiServer.Core.PageData'
at EPiServer.Core.DefaultContentLoader.ThrowTypeMismatchException(ContentReference link, Type actual, Type required)
at EPiServer.Core.DefaultContentLoader.Get[T](ContentReference contentLink, LoaderOptions loaderOptions)
at EPiServer.Core.DefaultContentLoader.Get[T](ContentReference contentLink)
at EPiServerImportService.EPiServerUtil.PopulateContentType()I could get the desired output using getChildren but i need to loop through descendents and it is bit awakward to explain others.
so, i need to know if i can use geeDescendents to get Id except for ContentFolder.If yes please help me understand it.
Any help will be much appreciated.
Have a look at the Alloy demo, more specific GetAll<T>(ContentReference rootLink) in the ContentLocator. You could get all descendents of a specific type that way.
Thank you Jeroen. much appreciated.