Need to find ContentBlocks using multiple tags
Hi,
I have a list of tick boxes on a form that are used to search ContentBlocks (the tick boxes are synonymous with the tags). If 3 tick boxes are checked, I want to retrieve all ContentBlock Titles that have at least one of those tick boxes (i.e. it is an OR condition). I have retrieved the GUID for each of the tags from the TaxonomyManager however I am now having trouble creating a valid expression that will select my ContentBlocks using 1 or more GUID values.
Help greatly appreciated...
Thanks
This is the current code I have added...
ContentManager mgr = ContentManager.GetManager();
List<
ContentItem
> articles = new List<
ContentItem
>();
articles = mgr.GetContent().Where(cI => (cI.Content.Contains(expression) &&
cI.Status == ContentLifecycleStatus.Live)).ToList();
As you have hinted at, it appears you are just searching for your tags in the content of your Content Blocks. I had to do something similar and I used the following post to help me out.
http://www.sitefinity.com/devnet/forums/sitefinity/sdk/sitefinity-4-0-taxonomy-categorization.aspx
I've used this solution to grab all the items that had one category. You might have to call this 3 times to get all the items you want and then you might have to filter out the duplicates. Or you might be able to figure out have to combine all the calls. Hopefully this helps. I apologize as I don't have any specific code to give you.