Question

I am trying to order a discussion list by the latest reply date, else if it doesn't have a reply order it by the thread created date.

This is what I have:

SPList discussionList = web.Lists["Discussions List"];
SPView view = discussionList.DefaultView; //Subject view
view.Query = @"<OrderBy>
                    <FieldRef Name='Modified' Ascending='False' />
                    <FieldRef Name='Created' Ascending='False' />
               </OrderBy>";

view.Update();
discBoardList.Update();

This does not produce the desired ordering.

Was it helpful?

Solution

Replying to a discussion does not change the the Modified date of it, The reply will be created as a new Item with ParentPostId equals to current discussion item id, So there will be no modification on the Discussion

Use "DiscussionLastUpdated" column to get the Last Modified date, I think this column also gets updated if a user likes/unlikes the item

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top