郁闷的讨论板,实现对讨论板添加项

          
 
//添加主题
            SPListItem parent = list.Items.Add();
            parent.FileSystemObjectType 
= SPFileSystemObjectType.Folder;
            parent[
"Title"= "讨论的主";
            parent[
"Body"= "讨论的内容";
            parent.Update();





//添加回复
            SPWeb web = SPContext.Current.Web;
            web.AllowUnsafeUpdates 
= true;
            SPList list 
= SPContext.Current.List;
            SPListItemCollection fs 
= list.Folders;
            Response.Write(fs.Count.ToString());

            SPListItem item 
= fs[0];
           
// Response.Write(item.Title + "<br>");
            string folderpath = "http://dg605:8888/"+item.Folder.Url ;
           
// Response.Write(folderpath + "<br>");
           
// Response.Write(item.Folder.Url + "<br>");
            SPListItem rep = list.Items.Add(folderpath, SPFileSystemObjectType.File);
            rep.Properties[
"DiscussionReply"= "回复";
            rep[
"Title"= "回复";
            rep[
"Body"= "回复";
            rep.Update();

posted on 2009-04-16 13:43  寂寞的DBOY  阅读(312)  评论(0编辑  收藏  举报