November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
If you had EPiServer Find I would recommend using that to find them, if you have to use the built in API I would try with IContentLoader's GetDescendant() method.
var contentLoader = ServiceLocator.Current.GetInstance<IContentLoader>();
contentLoader.GetDescendents(new ContentReference(blockFolderId)).Select(pageReference => contentLoader.Get<BlockData>(pageReference)).Where(block => block is MyBlockType)
Note that depending on how many blocks you have this can be quite a heavy operation.
Hope this helps
Frederik
You could use IContentModelUsage.ListContentOfContentType(ContentType contentType).
Forgot to mention that the component that implements the interface can be retrieved from IOC container.
Hi Guys
Thank you very much for your response, On your comment Johan, is there a method to get the ContentType either by a Guid or Sytem.Type to pass to the ListContentOfContentType?
Many Thanks
Dave
There is a method Load on IContentTypeRepository that takes a type as parameter and returns a ContentType
Hi All
Scattered throughout the site I am working on there are lots of videos, I have created a custom block for adding these. As part of the media area of the site though I need to pull in all of the videos, I want to do this programatically rather than relying on the users to add them all to a ContentArea, is there a way of programatically getting all blocks of a particular type like you would do for pages?
Many thanks
Dave