A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More.
AI OnAI Off
A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More.
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
q.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);
Best Regards,
Tom
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.
http://sdk.episerver.com/community/html/M_EPiServer_Community_Forum_ForumHandler_GetTopics.htm
/Mattias
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.
Hi,
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,
Helena