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
As far as I can see (and test) you code is good.
I have only two ideas for an explanation, and you probably have checked both but in case you have not: Either you misspelled IsHomeBlog in the code or when you created the attribute. Or the blogs are of a type that is not returned by the query, e.g. ExpertBlogs.
I am trying to query for a blog with custom boolean attribute set to 'true'.
I have written the following query to retrieve the blogs with attrubite 'IsHomeBlog' set to true.
BlogQuery blogQuery = new BlogQuery();
BooleanCriterion IsHomeCriterion= new BooleanCriterion();
IsHomeCriterion.Value = true;
blogQuery["IsHomeBlog"] = IsHomeCriterion;
// We only want user defined blogs
blogQuery.BlogType = new BlogTypeCriterion();
blogQuery.BlogType.Value = BlogType.UserBlog;
// Sort by the number of entries
blogQuery.OrderBy.Add(new CriterionSortOrder(blogQuery.NumEntries, EPiServer.Common.Sorting.SortingDirection.Descending));
BlogCollection blogs = BlogHandler.GetQueryResult(blogQuery,1,Limit,out totalItems);
. No blogs are returned now even though I have blogs where ishomeblog attribute is set to true . when i remove the custom attribute criterian, results are returned.
Custom attriburtes work fine with entryquery but not blogquery. Am i doing something wrong here?