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
{
}
查看全文
相关阅读:
springboot配置redis缓存
【spark】local模式运行
mybatis从入门到精通(二) 增删查改
学习设计模式
学习设计模式
mybatis从入门到精通(一) 入门
学习NIO 之 使用方法
学习 NIO 之 零拷贝
Java并发
学习设计模式
原文地址:https://www.cnblogs.com/yigedaizi/p/1454018.html
最新文章
枚举处理
表单发送文件及加自定义参数
加密
图片合并
文件辅助类封装
图片压缩
Ftp 文件操作封装
WebApi 文件上传,断点上传,分块上传,断点下载,查询 (图片的直接预览,视频边加载边播放)
WebApi 自定义版本选择器
关于注解@ModelAttribute
热门文章
HttpServletRequest与HttpServletResponse 之转发与重定向
jeesite平台导出功能
mysql语句积累(正确的sql语句是业务成功的一半)
点击显示的属性值,弹出相应信息页面
关于端口占用
关于lombok依赖包问题
为订单设定定时任务(触发器)
对mybatis进一步加深了解
mac 下设置全局变量
yarn 重要配置参数对应的含义
Copyright © 2011-2022 走看看