Try our conversational search powered by Generative AI!

FindPagesWithCriteria returning no results (while expected to)



so i've been working on some forum functions (basically extending alloytech stuff), and i want to get the number of posts one user has made.

I'm currently trying to use FindpagesWithCriteria:

DataFactory.Instance.FindPagesWithCriteria(forumStart.InheritedPageLink, _criterias);

As for the criterion, this will give me no result:

_criterias.Add(Manager.CreateCriteria(CompareCondition.Equal, "CreatedBy", PropertyDataType.String, Page.User.Identity.Name, true)); 

 While this one does:

_criterias.Add(Manager.CreateCriteria(CompareCondition.Equal, "PageTypeName", PropertyDataType.PageType, Manager.PostPageTypeName, true));


Has anyone dealt with this?



Dec 21, 2011 18:14

The type of PageTypeName is not PropertyDataType.PageType. To use PropertyDataType.PageType, use the property name PageTypeIDand the page type's ID, like here in the SDK. PageTypeName would be string, if it's even possible to search for.

Dec 21, 2011 19:04

Hmm, actually, i want to filter the pages by user. I'd like to count how many posts one has made, and his latest replies.

I don't know why that first criterion doesn't work. 

Dec 22, 2011 9:51

Oh, sorry, I read it backwards and my answer is completely incorrect...

Try chaning "CreatedBy" to "PageCreatedBy". All (well, almost...) the default properties are prefixed by "Page" in the database.

Dec 22, 2011 10:06

Oh, great, that works like a charm.

Thanks, Magnus.

Dec 22, 2011 10:18
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions 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.