This project is read-only.

Query all instances of a custom content item that are published for the value of the image field

Topics: Customizing Orchard
Jan 27, 2015 at 7:12 PM
Edited Jan 27, 2015 at 7:24 PM
I have a bunch of content items created from a custom type called BannerItem. I need to query, in my driver, for all instances of the BannerItem content type that are published. I then need to create a list of the image path for each BannerItem found. My BannerItem type has a part called BannerItem that contains an ImageField. This field stores the path in ContentField.Path how would I go about creating this list? None of the queries I have tried are working. Thank you.

Edit: The best I can come up with so far is
var publishedBannerItems = _contentManager.Query(VersionOptions.Published, "BannerItem").List();
            foreach(var bannerItem in publishedBannerItems)
Edit: Also I defined my content type and parts in my migrations so I don't think I can do something like .at<BannerItem> because BannerItem will be undefined. I may be wrong.