转:C# 对sharepoint 列表的一些基本操作,包括添加/删除/查询/上传文件给sharepoint list添加数据
2013-02-22 11:16
916 查看
============================================
using Microsoft.SharePoint;
SPWeb site = SPControl.GetContextWeb(Context);
SPListItemCollection items = site.Lists["ListName"].Items;
SPListItem item = items.Add();
item["Field_1"] = OneValue;
item["Field_2"] = TwoValue;
item.Update();
删除sharepoint list数据
=============================================
using Microsoft.SharePoint;
SPWeb site = SPControl.GetContextWeb(Context);
SPListItemCollection items = site.Lists["ListName"].Items;
items[0].Delete();
上传文件到sharepoint
=============================================
using System.IO;
using Microsoft.SharePoint;
if( htmlInputFile1.PostedFile != null )
查询记录及更新数据
===============================================
using Microsoft.SharePoint;
SPWeb web = new SPSite("http://nick").OpenWeb("test"); //Open website
web.AllowUnsafeUpdates = true;
SPList list = web.Lists["ListName"];
SPQuery query = new SPQuery();
query.Query = "<Where>"+
"<And><And>"+
"<Eq><FieldRef Name=/"Filed_1/"/><Value Type=/"Text/">Test</Value></Eq>" +
"<Eq><FieldRef Name=/"Filed_2/"/><Value Type=/"Text/">" + (string)OneValue + "</Value></Eq>" +
"</And>"+
"<Eq><FieldRef Name=/"Filed_3/"/><Value Type=/"Text/">" + (string)TwoValue + "</Value></Eq>" +
"</And>"+
"</Where>";
query.RowLimit = 10;
//查询
SPListItemCollection items = list.GetItems(query);
try
catch
{
}
Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1516166
using Microsoft.SharePoint;
SPWeb site = SPControl.GetContextWeb(Context);
SPListItemCollection items = site.Lists["ListName"].Items;
SPListItem item = items.Add();
item["Field_1"] = OneValue;
item["Field_2"] = TwoValue;
item.Update();
删除sharepoint list数据
=============================================
using Microsoft.SharePoint;
SPWeb site = SPControl.GetContextWeb(Context);
SPListItemCollection items = site.Lists["ListName"].Items;
items[0].Delete();
上传文件到sharepoint
=============================================
using System.IO;
using Microsoft.SharePoint;
if( htmlInputFile1.PostedFile != null )
查询记录及更新数据
===============================================
using Microsoft.SharePoint;
SPWeb web = new SPSite("http://nick").OpenWeb("test"); //Open website
web.AllowUnsafeUpdates = true;
SPList list = web.Lists["ListName"];
SPQuery query = new SPQuery();
query.Query = "<Where>"+
"<And><And>"+
"<Eq><FieldRef Name=/"Filed_1/"/><Value Type=/"Text/">Test</Value></Eq>" +
"<Eq><FieldRef Name=/"Filed_2/"/><Value Type=/"Text/">" + (string)OneValue + "</Value></Eq>" +
"</And>"+
"<Eq><FieldRef Name=/"Filed_3/"/><Value Type=/"Text/">" + (string)TwoValue + "</Value></Eq>" +
"</And>"+
"</Where>";
query.RowLimit = 10;
//查询
SPListItemCollection items = list.GetItems(query);
try
catch
{
}
Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1516166
相关文章推荐
- C# 对sharepoint 列表的一些基本操作,包括添加/删除/查询/上传文件给sharepoint list添加数据
- C# 对sharepoint 列表的一些基本操作,包括添加/删除/查询/上传文件给sharepoint list添加数据
- C# 对sharepoint 列表的一些基本操作,包括添加/删除/查询/上传文件给sharepoint list添加数据
- C# 对sharepoint 列表的一些基本操作,包括添加/删除/查询/上传文件给sharepoint list添加数据
- C# 对sharepoint 列表的一些基本操作,包括添加/删除/查询/上传文件给sharepoint list添加数据
- C# 对sharepoint 列表的一些基本操作,包括添加/删除/查询/上传文件给sharepoint list添加数据
- C# 对sharepoint 列表的一些基本操作,包括添加/删除/查询/上传文件给sharepoint list添加数据
- C# 对sharepoint 列表的一些基本操作,包括添加/删除/查询/上传文件给sharepoint list添加数据
- C# 对sharepoint 列表的一些基本操作,包括添加/删除/查询/上传文件给sharepoint list添加数据
- C# 对sharepoint 列表的一些基本操作,包括添加/删除/查询/上传文件给sharepoint list添加数据
- C# 对sharepoint 列表的一些基本操作,包括添加/删除/查询/上传文件给sharepoint list添加数据
- C# 对sharepoint 列表的一些基本操作,包括添加/删除/查询/上传文件给sharepoint list添加数据
- C# 对sharepoint 列表的一些基本操作,包括添加/删除/查询/上传文件给sharepoint list添加数据
- C# 对sharepoint 列表的一些基本操作,包括添加/删除/查询/上传文件给sharepoint list添加数据
- net,C#,Ftp各种操作,上传,下载,删除文件,创建目录,删除目录,获得文件列表
- c#ftp操作全解:创建删除目录,上传下载文件,删除移动文件,文件改名,文件目录查询
- 在SQL Server 集成服务中使用开源SharePoint List组件对SharePoint列表进行ETL操作!
- .net,C#,Ftp各种操作,上传,下载,删除文件,创建目录,删除目录,获得文件列表等
- .net,C#,Ftp各种操作,上传,下载,删除文件,创建目录,删除目录,获得文件列表等 收藏
- C# 文件操作(上传 下载 删除 文件列表...)