I'm following this thread which shows how to create a reply to a discussion using REST api. Basically -- created the reply at top level of list, get the reply parent folder, get the FileRef info about the reply, and move the reply under the parent.
That is all working well and the replies appear in the right spot and the parent discussion shows the correct number of replies.
I'm trying to update the Last updated column which has an internal name of DiscussionLastUpdated on the parent so that it can move to the top of our "recent" discussions list. It isn't updating -- neither through the rest calls, nor if I create a child reply through the UI.
I found threads like this which talk about permissions, and I will work on that problem later, but since I am only working with my stuff at the moment AND I am site collection admin with full control over everything....well I don't think that is currently the issue.
After a lot of work I finally found that I can update the Modified date with
var payload = { '__metadata': { "type": _listEntityName },
DiscussionLastUpdated: new Date().toJSON()
}
return $.ajax({ url: _webUrl + "/_api/web/lists/getbytitle('"+_listName+"')/Items("+itemId+")",
type: "POST",
data: JSON.stringify(payload),
headers:headers.MERGE
})
Even though I'm updating DiscussionLastUpdated, it is the Modified date that is updated.
Does anybody know how to update the Last updated/DiscussionLastUpdated independent of the Modified date?
EDIT: Bonus Question
There is also a LastReplyBy or LastReplyById which I can't seem to set either. There may well be other "rollup-to-the-parent-thread" features that I haven't noticed either. If anyone knows about this in REST or even JSOM please share.