One of those things where I think of...is this the best way to deal with it? :)
Situation: I have a standard discussion board list with a discussion thread in it. I want to add a reply programatically, to that discussion thread (not creating a new discussion).
There are two things to keep in mind when doing that:
- The ThreadID field, which is an ID that should be the same in each thread.
- The Ordering field, which is a timestamp when the item is created.
When you want to add a new item in the same thread, you should create a new list item, duplicate the ThreadID and the set the timestamp, which is a duplicate of the original thread, PLUS the new timestamp. In code something like this:
SPListItem newItem = discussionList.Items.Add();
newItem["Title"] = "Title of item";
newItem["Body"] = "Body Text";
newItem["ThreadID"] = [ThreadID of original thread];
newItem["Ordering"] = [Ordering of original thread] + DateTime.Now.ToString("yyyyMMddhhmmss");
newItem.Update();
I wonder where this is in the SDK...or anywhere else...