Tuesday, February 16, 2010

How to reply on discussion thread programmatically – Part 1

Hi All,

We all know how to create discussion list programmatically, however question comes how to reply individual discussion thread programmatically.

Well, before starting, just would like to tell you that in this post, I am going to cover very basic idea about discussion list objects and some tips. However in next part 2, I am going to cover in detail about replies and individual threads of discussion list.

This is how you create the discussion list programmatically and its discussion topic in it.

Create Discussion list programmatically and add thread programmatically

Let’s say you have now your topic in your hand and then we need to take out that topic as SPListItem object.

SPListItem reply = SPUtility.CreateNewDiscussionReply({SPListItem Topic Object});
reply["Body"] = "Yeh!!This is reply from code.";

So this is a reply to a thread created programmatically. Watch out for next part as it explains in depth details about discussion list coding stuff.


sudheer said...

Thanks for the post..
My requirement is similar to this one..

I want to show all the replies of a discussion item in a grid view(i am showing all discussions in a gridview. If user selects one gridview row, i want to show all the replies corresponding to that discussion topic in another gridview) to enable 'deleting multiple replies at a time'. But i was unable to access reply items. How can i do that using object model.

I am a fresher for sharepoint ..so please explain me in detail...

Thanks & Regards,
Sudheer Gupta.

SharePoint Kings said...


not sure how to achieve your exact requirement because we had not tried that way.

but you should get this thing from sharepoint object model only.

its interesting topic so we will try and get back to once we will get time.

Share your SharePoint Experiences with us...
As good as the SharePointKings is, we want to make it even better. One of our most valuable sources of input for our Blog Posts comes from ever enthusiastic Visitors/Readers. We welcome every Visitor/Reader to contribute their experiences with SharePoint. It may be in the form of a code stub, snippet, any tips and trick or any crazy thing you have tried with SharePoint.
Send your Articles to sharepointkings@gmail.com with your Profile Summary. We will Post them. The idea is to act as a bridge between you Readers!!!

If anyone would like to have their advertisement posted on this blog, please send us the requirement details to sharepointkings@gmail.com