如何以编程方式读取SharePoint列表?

时间:2021-03-01 23:08:49

I currently use the Linq to SharePoint to retrieve data from several SharePoint lists.

我目前使用Linq to SharePoint从多个SharePoint列表中检索数据。

This is my current preferred method of coding my way from ASP.NET and WinForms to retrieve this data.

这是我目前首选的从ASP.NET和WinForms编写代码来检索此数据的方法。

My only issue with this project:

这是我唯一的问题:

I have to manually generate the SPML file and add this to the development environment, compile it in the project, and only then I am able to use it to connect to the List.

我必须手动生成SPML文件并将其添加到开发环境中,在项目中编译它,然后才能使用它连接到List。

This is great for projects that require connecting to the one and the same list always.

这对于需要始终连接到同一个列表的项目非常有用。

But I am having users creating new workspaces (sites) with each its own List from which I want to retrieve data automagically (same as linq to sharepoint does, but not statically).

但我正在让用户创建新的工作区(站点),每个列表都有自己的List,我想从中自动检索数据(与linq相同,但不是静态)。

Can you recommend your preferred way of accessing data from several SharePoint Lists and sites in C# WinForms and/or ASP.NET outside an actual SharePoint environment where I can specify the a new source site and list at run time?

您是否可以推荐在实际SharePoint环境之外从C#WinForms和/或ASP.NET中的多个SharePoint列表和站点访问数据的首选方法,我可以在运行时指定新的源站点和列表?

2 个解决方案

#1


9  

You have several options both of which are going to require further research on your part they are:

您有多种选择,这两种选择都需要您进一步研究:

  1. Use the SharePoint object model (Microsoft.Sharepoint.dll), you must be on a PC within the SharePoint farm.
  2. 使用SharePoint对象模型(Microsoft.Sharepoint.dll),您必须位于SharePoint场中的PC上。
  3. Use the SharePoint web services which can be found at SiteURL/_vti_bin/ you might want to start with Lists.asmx and work from there.
  4. 使用可以在SiteURL / _vti_bin /找到的SharePoint Web服务,您可能希望从Lists.asmx开始并从那里开始工作。

You are going to need some further research as I have said, but remember GIYF.

正如我所说,你将需要进一步的研究,但请记住GIYF。

#2


4  

I would really encourage everyone on this topic to have a look at the ado.net driver for sharepoint from bendsoft.com. It is free for developers to use and allows you to query sharepoint information using standard sql syntax and takes care of all sorts of conversion for you.

我真的鼓励关于这个主题的每个人都可以从bendsoft.com查看sharepoint的ado.net驱动程序。开发人员可以免费使用,并允许您使用标准的sql语法查询共享点信息,并为您处理各种转换。

Dim conn As New SharePointConnection("Server=mysharepointserver.com;Database=sitepath;User=spuser;Password=******;")
conn.Open()
Dim cmd As New SharePointCommand("UPDATE Employees SET Salary = 3250.50 WHERE Name = 'Steve Watson'", conn)
cmd.ExecuteNonQuery()

#1


9  

You have several options both of which are going to require further research on your part they are:

您有多种选择,这两种选择都需要您进一步研究:

  1. Use the SharePoint object model (Microsoft.Sharepoint.dll), you must be on a PC within the SharePoint farm.
  2. 使用SharePoint对象模型(Microsoft.Sharepoint.dll),您必须位于SharePoint场中的PC上。
  3. Use the SharePoint web services which can be found at SiteURL/_vti_bin/ you might want to start with Lists.asmx and work from there.
  4. 使用可以在SiteURL / _vti_bin /找到的SharePoint Web服务,您可能希望从Lists.asmx开始并从那里开始工作。

You are going to need some further research as I have said, but remember GIYF.

正如我所说,你将需要进一步的研究,但请记住GIYF。

#2


4  

I would really encourage everyone on this topic to have a look at the ado.net driver for sharepoint from bendsoft.com. It is free for developers to use and allows you to query sharepoint information using standard sql syntax and takes care of all sorts of conversion for you.

我真的鼓励关于这个主题的每个人都可以从bendsoft.com查看sharepoint的ado.net驱动程序。开发人员可以免费使用,并允许您使用标准的sql语法查询共享点信息,并为您处理各种转换。

Dim conn As New SharePointConnection("Server=mysharepointserver.com;Database=sitepath;User=spuser;Password=******;")
conn.Open()
Dim cmd As New SharePointCommand("UPDATE Employees SET Salary = 3250.50 WHERE Name = 'Steve Watson'", conn)
cmd.ExecuteNonQuery()