November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
What do you want to find?
You could use IContentModelUsage like below;
var contentTypeRepository = ServiceLocator.Current.GetInstance<IContentTypeRepository>();
var repository = ServiceLocator.Current.GetInstance<IContentRepository>();
var contentModelUsage = ServiceLocator.Current.GetInstance<IContentModelUsage>();
var myblockType = contentTypeRepository.Load<MyBlockType>();
List<ContentReference> myblockTypeReferences = contentModelUsage.ListContentOfContentType(myblockType).Select(x => x.ContentLink.ToReferenceWithoutVersion()).ToList();
then you could iterate through your references to get the data you need.
foreach(ContentReference cref in myblockTypeReferences) {
MyBlockTypemyblock;
repository.TryGet<MyBlockType>(cref, out myblock);
}
or maybe IContentRepository.GetDescendents(ContentReference.BlockFolderToLookIn)
I'm don't think there is a way to search for blocks the same way as FindPagesWithCriteria
Hello
So, one would think there would be some way to search for blocks in the same way you search for pages using FindPagesWithCriteria, but I can't seem to find anything. Anyone have a clue or suggestion?
Thanks
Fredrik