[英]how read data from sharepoint list in asp.net site
I have some data in sharepoint lists,I want to read particular data from the list and show them in my asp.net website,what should i do ? 我的共享点列表中有一些数据,我想从列表中读取特定数据,并在asp.net网站上显示它们,该怎么办?
I don't want use sharepoint linq. 我不想使用sharepoint linq。
Microsoft SharePoint 2010通过使用Windows Communication Foundation(WCF)数据服务引入了新的基于REST的Web服务http://msdn.microsoft.com/zh-cn/library/hh134614(v=office.14).aspx查看此答案: https : //stackoverflow.com/a/18624371/820436
You can read data from SharePoint in your ASP.NET Using SharePoint CSOM. 您可以使用SharePoint CSOM从ASP.NET中的SharePoint中读取数据。
Client-Side Object Model (CSOM)
is mainly used to build client applications and enable us to access SharePoint Sites that are hosted outside without using web services. Client-Side Object Model (CSOM)
主要用于构建客户端应用程序,并使我们无需使用Web服务即可访问在外部托管的SharePoint网站。
What do you need in order to use CSOM? 您需要什么才能使用CSOM?
You just needed to add the below assemblies as a reference to your solution to be able to work with the Client Object Model. 您只需要添加以下程序集即可作为解决方案的参考,以便能够与客户端对象模型一起使用。
These assemblies can be found in the 14 Hive folder: %ProgramFiles%\\Common Files\\Microsoft Shared\\web server extensions\\14\\ISAPI.
可以在14个Hive文件夹中找到这些程序集:
%ProgramFiles%\\Common Files\\Microsoft Shared\\web server extensions\\14\\ISAPI.
So you should copy it first from your SharePoint Server to your solution folder then add it as a reference in your solution. 因此,您应该首先将其从SharePoint Server复制到解决方案文件夹,然后将其添加为解决方案中的参考。
For Complete basic operations using SharePoint client library code check 有关使用SharePoint客户端库代码完成基本操作的信息,请检查
Also, you can Accessing SharePoint 2010 Lists by Using REST-based web services
for more details/ examples check this MSDN article Accessing SharePoint 2010 Lists by Using WCF Data Services 另外,您可以使用
REST-based web services
访问SharePoint 2010列表以了解更多详细信息/示例,请查看此MSDN文章,使用WCF数据服务访问SharePoint 2010列表。
You can use REST API to retrieve SharePoint list items. 您可以使用REST API检索SharePoint列表项。 You can use REST API in C# and also in java-script.
您可以在C#和Java脚本中使用REST API。
The following is the java-script code which retrieves list (Employee) items from the sharepoint devsite using REST API. 以下是Java脚本代码,该代码使用REST API从sharepoint开发站点检索列表(员工)项目。
<script type="text/javascript" src="https://name.sharepoint.com/sites/devsite/SiteAssets/jquery-1.9.1.min.js"> </script>
<script type="text/javascript">
$(document).ready(function () {
$('#getEmployee').click(function () {
$.ajax({
url: "https://name.sharepoint.com/sites/devsite/_api/web/lists/getbytitle('Employee') /items",
method: "GET",
headers: { "Accept": "application/json;odata=verbose" },
success: function (data) {
*** You can Parse your data under this function***
}
},
error: function () {
alert("Response fails");
}
})
})
})
</script>
<input type="button" value="GET" name="GET" id="getEmployee"/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.