Domanda

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.

È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top