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
{
}
查看全文
相关阅读:
redis应用场景
java.lang.IllegalArgumentException: Result Maps collection already contains value for xxx
Java问题解决:Java compiler level does not match the version of the installed Java project facet.
win10 安装Oracle 11g release 2
Oracle 11G Client客户端安装
Oracle分页查询排序数据重复问题
Mysql 函数使用记录(三)——UNIX_TIMESTAMP() 、UNIX_TIMESTAMP(date)
PL/SQL Developer过期解决方法
PL/SQL Developer登录出现——Using a filter for all users can lead to poor performance!
Oracle Single-Row Functions(单行函数)——NULL-Related Functions
原文地址:https://www.cnblogs.com/yigedaizi/p/1454018.html
最新文章
ZooKeeper_基础知识学习
dubbo_实现Hessian的远程调用协议
dubbo_分布式框架dubbox介绍
dubbo_远程同步调用原理
dubbo_rpc原理
dubbo_分布式Rpc服务
Token_使用JWT生成token
Redis_发布订阅(基础)
html5_websocket_tomcat8
jQuery读取json文件
热门文章
一台linux机器远程mount另一台linux机器
k8s常用命令
window下启动redis服务
通信发展史
python中的实例属性和类属性
vim输入操作
flask的请求上下文request对象
os.environ.get()的用法
k8s上的基础概念和术语
小白的git克隆流程clone
Copyright © 2011-2022 走看看