AI OnAI Off
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>();
Hi,
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
contentArea.Contents
To retrieve the content referenced in the content area directly.
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?
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.
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:
Then I fetch each referenced content item by Guid:
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.