Wednesday, 5 September 2012

Adding Item to a task list

//Adding the items to task(Custome task list earliar created)list
        SPSite rootSite = new SPSite("Http://Mohan/site1");
        SPWeb web = rootSite.OpenWeb();
        //Security setting that allows you to add to / modify the site
        web.AllowUnsafeUpdates = true;
        SPList taskList = web.Lists["Custom Task List"];
        //Adding new task
        SPListItem newTask = taskList.Items.Add();
        newTask["Title"] = "Work on SPS 2010/13";
        newTask["PercentComplete"] = 0.1;
        newTask.Update();
        Response.Write("items manupulation completed..");

No comments:

Post a Comment