SPList oList = oWeb.Lists["My Discussion"]; SPListItemCollection myListItems = oList.Items; SPListItem oFirstItem = SPUtility.CreateNewDiscussion(myListItems, "Talk about Task X"); oFirstItem["Body"] = "What say you about task X?"; oFirstItem.Update(); SPListItem oReply1 = SPUtility.CreateNewDiscussionReply(oFirstItem); oReply1["Body"] = "my reply @" + DateTime.Now.ToString(); oReply1.Update();
Friday, 9 October 2009
We had a requirments to create new discussions and the responses using SharePoint object model. Here is the code which we used to create this.