Listing all properties on page


I am having a bit of trouble in listing all properties within a page. By "all" I mean those withing blocks within content areas too. Actually those within blocks which are within blocks, within content area.

Now this is where I get stuck. I get all referenced items in a content area:

var contentArea = (ContentArea)property.Value;
IList<Guid> contentReferences = contentArea.ReferencedPermanentLinkIds;


Then I fetch each referenced content item by Guid:

foreach (var contentRef in contentReferences)
  var content = repository.Get<IContent>(contentRef, new LanguageSelector(languageId));



Now there I get stuck because I should be able to check if content is BlockData or some other type. What I get is a proxy from Castle. If somebody knows what to use with repository.Get<...> or some other way please share.


Jan 23, 2013 16:59

I tried to use <ContentData> instead of <IContent> when getting a content, but still result is of Castle proxy class.

Addition, repository in second code block in first post is actually:

IContentRepository repository = ServiceLocator.Current.GetInstance<IContentRepository>();


Edited, Jan 23, 2013 17:22


content is BlockData

Will tell you wether it's a block or not. The proxy class inherits the original block class.

Also, you can do


To retrieve the content referenced in the content area directly. 


Edited, Jan 23, 2013 20:11

Thank you. As .Contents returns the first level content is there some method that can return all content below recursively, something like GetChildren down to bottom or some level?

Jan 24, 2013 16:05

I don't think so. There are such functionality in EPiServer Find's API and maybe/probably in EPiServer Search's as well, but I don't think there's any such public method in the CMS' API.

Jan 24, 2013 22:16
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.