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?
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 23q.Room.ID.Includes.Values.Add(1);q.Room.ID.Includes.Values.Add(7);q.Room.ID.Includes.Values.Add(23);MessageCollection topics = QueryHandler.GetQueryResult<EPiServer.Community.Forum.Message, MessageCollection>(q, 1, 10, out itemCount);
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.
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.
Yep, that's correct. If you want to do more filtering you need to use the query system.