Try our conversational search powered by Generative AI!

How to get topics from certain rooms?



I would like to list recent topics from several (but not all) rooms. I'm using a TopicQuery so TopicQuery.Room seems like a good start, but I can't figure out how to add more than one room ID to the query?

Best regards,

Feb 04, 2009 13:36

Hi Helena,

Something like this should work:

TopicQuery q = new TopicQuery();
q.Room = new RoomCriterion();
q.Room.ID = new IntegerCriterion();
q.Room.ID.Includes = new IntegerInCriterion();

// Inlcude rooms with id 1, 7 and 23

MessageCollection topics =
QueryHandler.GetQueryResult<EPiServer.Community.Forum.Message, MessageCollection>(q, 1, 10, out itemCount);

Best Regards,


Edited, Feb 05, 2009 15:21

There is also the built in ForumHandler.GetTopics method that takes a RoomCollection as an argument. It will be quicker and you can use the specialised sort orders.


Feb 05, 2009 16:27
Nice one Mattias, didn't think of that Wink
Feb 05, 2009 16:30

Thanks a lot for your quick answers!

I think I need to use the query (?) since I want to filter on other properties as well, such as creation dates and number of topic replies.

Feb 05, 2009 16:42

Yep, that's correct. If you want to do more filtering you need to use the query system.

Best regards,

Feb 06, 2009 9:19
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.