C# 通过SDK连接到Sharepoint Services 3:获取500-ExecuteQuery()上出现内部服务器错误

C# 通过SDK连接到Sharepoint Services 3:获取500-ExecuteQuery()上出现内部服务器错误,c#,sharepoint,C#,Sharepoint,这是我第一次使用Sharepoint SDK,我很难将东西连接起来 背景是Sharepoint网站是TFS 2010中的项目门户。它是Sharepoint Services 3.0 我尝试运行一个相当简单的函数: using SP = Microsoft.SharePoint.Client; class Program { static void Main(string[] args) { using (SP.ClientContext ctx = new SP.ClientC

这是我第一次使用Sharepoint SDK,我很难将东西连接起来

背景是Sharepoint网站是TFS 2010中的项目门户。它是Sharepoint Services 3.0

我尝试运行一个相当简单的函数:

using SP = Microsoft.SharePoint.Client;

class Program
{
  static void Main(string[] args)
  {
    using (SP.ClientContext ctx = new SP.ClientContext("http://<hostname>/sites/Projects"))
    {
      SP.Web web = ctx.Web;

      ctx.Load(web);
      ctx.Load(web.Lists);

      ctx.ExecuteQuery();

      foreach (var list in web.Lists)
      {
        Console.WriteLine("List Name: {0}", list.Title);
      }

    }

    Console.ReadLine();
  }
}
使用SP=Microsoft.SharePoint.Client;
班级计划
{
静态void Main(字符串[]参数)
{
使用(SP.ClientContext ctx=new SP.ClientContext(“http:///sites/Projects"))
{
SP.Web=ctx.Web;
ctx.Load(web);
ctx.Load(web.list);
ctx.ExecuteQuery();
foreach(web.Lists中的var列表)
{
WriteLine(“列表名:{0}”,List.Title);
}
}
Console.ReadLine();
}
}
在ExecuteQuery()调用中,它返回一个500内部服务器错误。你知道会发生什么吗


谢谢

正如Brian指出的,SharePoint Services 3.0不支持SharePoint 2010中实现的客户端OM


在SharePoint Services 3.0/MOSS 2007中,您需要使用Web服务-请参见

您使用的是SharePoint 2010 SDK代码,而不是2007代码。