Try our conversational search powered by Generative AI!

Blog query with custom attributes not working


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?


Mar 08, 2010 16:47

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.



Mar 09, 2010 10:16
This thread is locked and should be used for reference only. Please use the Legacy add-ons forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.