怎么样在sharepoint 2010 中操作List的办法
2010-11-06 14:20:29 来源:WEB开发网核心提示: /// <summary> /// 删除栏 /// </summary> /// <param name="sender"></param> /// <param name=
/// <summary> /// 删除栏 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnAddField_Click(object sender, EventArgs e) { using (SPSite site = new SPSite(requestUrl)) { using (SPWeb web = site.OpenWeb()) { string listName = txtFieldList.Text.Trim(); SPList list = web.Lists[listName]; //list.Fields.Delete("Price"); //删除栏 //list.Update(); } } }
/// <summary> /// 修改栏 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnAddField_Click(object sender, EventArgs e) { using (SPSite site = new SPSite(requestUrl)) { using (SPWeb web = site.OpenWeb()) { string listName = txtFieldList.Text.Trim(); SPList list = web.Lists[listName]; //修改栏 //list.Fields["标题"].Title = "Title"; //list.Fields["标题"].Update(); //list.Update(); } } }
using (SPSite site = new SPSite(requestUrl)) { using (SPWeb web = site.OpenWeb()) { SPList bookList = web.Lists["Books"]; SPListItem item = bookList.Items.Add(); item["Title"] = "流氓是怎么炼成的"; item["ISBN"] = "12345"; item["LeadAuthor"] = "abc"; item.Update(); } }
Tags:sharepoint List
编辑录入:爽爽 [复制链接] [打 印]更多精彩
赞助商链接