Join us this Friday for AI in Action at the Virtual Happy Hour! This free virtual event is open to all—enroll now on Academy and don’t miss out.
Join us this Friday for AI in Action at the Virtual Happy Hour! This free virtual event is open to all—enroll now on Academy and don’t miss out.
You can use FindPagesWithCriteria
IPageCriteriaQueryService queryService = ServiceLocator.Current.GetInstance<IPageCriteriaQueryService>();
var contentLoader = ServiceLocator.Current.GetInstance<IContentLoader>(); contentLoader.GetDescendents(new ContentReference(blockFolderId)) .Select(blockReference => contentLoader.Get<IContent>(blockReference)) .Where(block => block.Name=="MyBlock")
Something like that...
Probably want to add a content reference instead to it somewhere if possible because of performance of above code...
IPageCriteriaQueryService doesn't work for blocks. Do you Episerver Find? Otherwise you have to do as Daniel suggested.
Is there any method in content repository to get or find a block by name property?