//Adding new list -- taking the task list as template and creating new list item
// Create site1 and implement
SPSite rootSite = new SPSite("Http://Mohan/Asite");
SPWeb web = rootSite.OpenWeb();
//Security setting that allows you to add to / modify the site
web.AllowUnsafeUpdates = true;
SPListTemplate sourceTemplate = web.ListTemplates["Tasks"];
Guid newListGuid = web.Lists.Add("Custom Task List", "Custom Task List", sourceTemplate);
SPList newList = web.Lists[newListGuid];
newList.Description = "Modified Custom Task List";
newList.Update();
Response.Write("Is added succes fully..");
// Create site1 and implement
SPSite rootSite = new SPSite("Http://Mohan/Asite");
SPWeb web = rootSite.OpenWeb();
//Security setting that allows you to add to / modify the site
web.AllowUnsafeUpdates = true;
SPListTemplate sourceTemplate = web.ListTemplates["Tasks"];
Guid newListGuid = web.Lists.Add("Custom Task List", "Custom Task List", sourceTemplate);
SPList newList = web.Lists[newListGuid];
newList.Description = "Modified Custom Task List";
newList.Update();
Response.Write("Is added succes fully..");
No comments:
Post a Comment