Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

FindPagesWithCriteria returning no results (while expected to)

Vote:
 

Hi,

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?

 

TIA 

#55887
Dec 21, 2011 18:14
Vote:
 

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.

#55888
Dec 21, 2011 19:04
Vote:
 

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. 

#55896
Dec 22, 2011 9:51
Vote:
 

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.

#55897
Dec 22, 2011 10:06
Vote:
 

Oh, great, that works like a charm.

Thanks, Magnus.

#55898
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.