using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Utilities;
namespace DiscussionBoardPoster
{
class Program
{
static void Main(string[] args)
{
SPSite site = new SPSite("http://kopperla:2030/Movies");
using (SPWeb web = site.OpenWeb())
{
SPList list = web.Lists["Prince"];
SPListItemCollection myListCol = list.Items;
SPListItem disc = SPUtility.CreateNewDiscussion(myListCol, "Excellence2");
disc["Body"] = "C Sharp is great";
SPFieldUserValue oUser = new SPFieldUserValue(web, 289, "matcha");
disc.Update();
SPListItem reply = SPUtility.CreateNewDiscussionReply(disc);
reply["Body"] = "I like C Sharp and VB.NET much";
reply["Author"] = oUser;
reply["Editor"] = oUser;
reply["Created"] = DateTime.Parse("14 Jul 2006");
reply["Modified"] = DateTime.Parse("14 Jul 2006");
reply.Update();
SPListItem reply2 = SPUtility.CreateNewDiscussionReply(reply);
reply2["Body"] = "I like C Sharp and VB.NET too mubh";
reply["Author"] = oUser;
reply2["Editor"] = oUser;
reply2["Created"] = DateTime.Parse("10/22/2008");
reply2["Modified"] = DateTime.Parse("10/22/2008");
reply2.Update();
disc["Author"] = oUser;
disc["Editor"] = oUser;
disc["Last Updated"] = DateTime.Parse("10/22/2008");
disc["Created"] = DateTime.Parse("10/22/2008");
disc["Modified"] = DateTime.Parse("10/22/2008");
disc.Update();
}
}
}
}
No comments:
Post a Comment