lördag 7 mars 2009

WSS Create Discussion Board item

Creating and manipulating ordinary lists in WSS through the object model is easy, and finding examples on the web is also easy. But what about discussion boards?

Turns out that they are not as easily manipulated, and examples are very hard to find. After much browsing I found this information though:

Use this code:
using Microsoft.Sharepoint.Utilities;

SPListItem item = SPUtility.CreateNewDiscussion(.Items, "");
item["Body"] = "";

There is a corresponding method to add discussion replies:

Inga kommentarer:

Skicka en kommentar