如何从 Winform 应用程序查询 Sharepoint 2010 列表?
How to query a Sharepoint 2010 List from Winform Application?
从 VB.Net Windows Forms 应用程序查询 SharePoint 2010 列表的最简单途径是什么。
使用 Microsoft here 记录的 .NET 客户端对象模型,您可以编写 C# 或 VB.Net 代码来访问 SharePoint。
Microsoft 已提供 a walkthrough 向您展示如何将所需的程序集添加到项目中。
相关摘录如下:
In your project, add references to the two required assemblies that compose the .NET client object model. These two assembles (Microsoft.SharePoint.Client.dll and Microsoft.SharePoint.Client.Runtime.dll) are located in the ISAPI folder of %ProgramFiles%\Common Files\Microsoft Shared\web server extensions.
加载程序集后,您可以使用 SharePoint 客户端对象模型对象检索记录的信息 here。例如:
How to retrieve objects
The following example shows how to load an object to access its properties. Because the list object is loaded in place, all default properties of the list can be accessed.
Dim clientContext As New ClientContext("http://MyServer/sites/MySiteCollection")
Dim oWebsite As Web = clientContext.Web
Dim collList As ListCollection = oWebsite.Lists
Dim oList As List = collList.GetByTitle("Announcements")
clientContext.Load(oList)
clientContext.ExecuteQuery()
Console.WriteLine("Title: {0} Created: {1}", oList.Title, oList.Created)
有关更深入的文档,请参阅上面的链接。
从 VB.Net Windows Forms 应用程序查询 SharePoint 2010 列表的最简单途径是什么。
使用 Microsoft here 记录的 .NET 客户端对象模型,您可以编写 C# 或 VB.Net 代码来访问 SharePoint。
Microsoft 已提供 a walkthrough 向您展示如何将所需的程序集添加到项目中。
相关摘录如下:
In your project, add references to the two required assemblies that compose the .NET client object model. These two assembles (Microsoft.SharePoint.Client.dll and Microsoft.SharePoint.Client.Runtime.dll) are located in the ISAPI folder of %ProgramFiles%\Common Files\Microsoft Shared\web server extensions.
加载程序集后,您可以使用 SharePoint 客户端对象模型对象检索记录的信息 here。例如:
How to retrieve objects
The following example shows how to load an object to access its properties. Because the list object is loaded in place, all default properties of the list can be accessed.
Dim clientContext As New ClientContext("http://MyServer/sites/MySiteCollection") Dim oWebsite As Web = clientContext.Web Dim collList As ListCollection = oWebsite.Lists Dim oList As List = collList.GetByTitle("Announcements") clientContext.Load(oList) clientContext.ExecuteQuery() Console.WriteLine("Title: {0} Created: {1}", oList.Title, oList.Created)
有关更深入的文档,请参阅上面的链接。