Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
You could use:
IContentModelUsage.ListContentOfContentType(ContentType contentType)
where the parameter contentType can be retrieved from IContentTypeRepository.Load(Type modelType)
where you pass in the block type.
ListContentOfContentType will return both all shared block instances of the type and all content instances that has a property of the block type.
Great feedback Johan!
I found it also can be shortened a little (because in my case, I have the ID already)
var usage = contentUsage.ListContentOfContentType(new ContentType{ID=contentID.ID});
Hi,
If you run the code using eg\
var propCrit = new PropertyCriteriaCollection
{
new PropertyCriteria() {Name = "PageTypeID", Type = PropertyDataType.Block},
};
you pas the ID of the blockdata type, it will return with an exception that this is not supported.
So, now I'm left with the question; how can I search for all pages using a certain blockdata type?
Thanks!