Creating Sharepoint List using object model
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;
SPWeb mySite = SPContext.Current.Web;
SPListCollection lists = mySite.Lists;
string listTitle = "List Title";
string listDescription = "Lst Description";
string listType = "Announcements";
SPListTemplateType listTemplateType = new SPListTemplateType();
listTemplateType = SPListTemplateType.Announcements;
lists.Add(listTitle, listDescription, listTemplateType);
Delete Sharepoint List
SPWeb mySite = SPContext.Current.Web;
SPListCollection lists = mySite.Lists;
SPList list = lists["ListName"];
System.Guid listGuid = list.ID;
lists.Delete(listGuid);
Update Sharepoint List
SPWeb mySite = SPContext.Current.Web;
SPListItemCollection listItems = mySite.Lists["ListName"].Items;
SPListItem item = listItems.Add();
item["Title"] = "List Title";
item["First Name"] = "FirstName";
item["Last Name"] = "Last Name";
item["Address"] = "Address";
item.Update();
}
-Bharath Boddu
Friday, March 27, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment