zoukankan
html css js c++ java
C#操作SharePoint列表
============================================
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
)
{
SPWeb site
=
new
SPSite(destinationURL).OpenWeb();
Stream stream
=
htmlInputFile1.PostedFile.InputStream;
byte
[] buffer
=
new
bytes[stream.Length];
stream.Read(buffer,
0
, (
int
) stream.Length);
stream.Close();
site.Files.Add(destinationURL, buffer);
}
查询记录及更新数据
===============================================
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
{
if
(Items.Count
!=
0
)
{
//
更新sharepoint list 数据
foreach
(SPListItem list
in
listItems)
{
list[
"
Filed_1
"
]
=
TextBox1.text.ToString();
list[
"
Filed_2
"
]
=
TextBox2.text.ToString();
list[
"
Filed_3
"
]
=
TextBox3.text.ToString();
listItem.Update();
}
}
else
{
//
将数据记录添加进sharepoint
SPListItem addlist
=
List.Items.Add();
addlist[
"
Filed_1
"
]
=
TextBox1.Text.ToString();
addlist[
"
Filed_2
"
]
=
TextBox2.Text.ToString();
addlist[
"
Filed_3
"
]
=
TextBox3.Text.ToString();
addlist.Update();
}
}
catch
{
}
查看全文
相关阅读:
oracle如何在所有procedure里搜索某些关键字, 存储过程
Delphi 中文件的操作FileOpen
【oracle】varchar和varchar2区别
Delphi 2010 新增功能之: IOUtils 单元(6): TPath(结构体) 的方法与属性
oracle如何在所有procedure里搜索某些关键字, 存储过程
Delphi ADOConnection连接 sqlserver
一种在SQLServer中实现Sequence的高效方法
SQL Server 序列(SEQUENCE)使用
[惠普HP] HP1215出现硒鼓底灰刮板拆机图解教程
记录一下 山客 BK650 UPS 的配置软件下载地址
原文地址:https://www.cnblogs.com/yigedaizi/p/1454018.html
最新文章
(ASP调用https提示“证书颁发机构无效或不正确”)ServerXMLHTTP具有自签名证书的https请求
apache: apache-tomcat-6.0.35完整下载
vue 自带的 bus 事件使用
vue中防止用户在短时间内频繁多次点击按钮
vue 几种配置缓存与不缓存
js 异步处理
kettle使用2-增量插入
kettle使用1-全表导入
Kettle下载和安装
postgresql 自动类型转换
热门文章
java调用webservice接口
关于Delphi7中日期函数StrtoDate的正确用法 win7报错
Delphi 获取系统时间分隔符
在Delphi中处理数据库日期型字段的显示与输入
DELPHI7对日期格式的处理
delphi private public protected
java推荐学习计划(一) 江北晓白
java学习教程推荐
ORACLE 查询哪个存储过程含有某个关键字
delphi安装 Tclientsocket, Tserversocket控件
Copyright © 2011-2022 走看看