无法使用sharepoint客户端对象模型连接到sharepoint网站
我正在尝试编写一个控制台应用程序来连接到我们的一个sharepoint应用程序站点。我正在运行一个基本示例以确保连接。程序不断失败,出现以下错误: 远程服务器返回错误:(500)内部服务器错误 状态:System.Net.WebExceptionStatus.ProtocolError 我没有访问IIS服务器以检查日志的权限。我的代码如下:无法使用sharepoint客户端对象模型连接到sharepoint网站,sharepoint,Sharepoint,我正在尝试编写一个控制台应用程序来连接到我们的一个sharepoint应用程序站点。我正在运行一个基本示例以确保连接。程序不断失败,出现以下错误: 远程服务器返回错误:(500)内部服务器错误 状态:System.Net.WebExceptionStatus.ProtocolError 我没有访问IIS服务器以检查日志的权限。我的代码如下: string siteUrl = "http://spsiteurl/"; ClientContext clientCo
string siteUrl = "http://spsiteurl/";
ClientContext clientContext = new ClientContext(siteUrl);
clientContext.AuthenticationMode = ClientAuthenticationMode.Default;
clientContext.Credentials = new NetworkCredential("...", "...", "...");
Web oWebsite = clientContext.Web;
clientContext.Load(oWebsite,
w => w.Title);
clientContext.ExecuteQuery();
Console.WriteLine(oWebsite.Title);
有什么方向我可能会出错吗?试试下面的代码
ClientContext context = new ClientContext("https://test.com/");
System.Net.ServicePointManager.ServerCertificateValidationCallback =
((sender, certificate, chain, sslPolicyErrors) => true);
string strUserName = @"abc";
string strPassword = "pwd";
var credentials = new NetworkCredential(strUserName, strPassword);
Web web = context.Web;
context.Load(web, w => w.Title);
context.Credentials = credentials;
context.ExecuteQuery();
// Now, the web's properties are available and we could display
// web properties, such as title.
System.Console.WriteLine("Web Title");
System.Console.WriteLine(web.Title);
它将在控制台中正常工作为了使其正常工作,您必须在运行此网站的SharePoint web前端上运行此代码。这就是你在做的吗?不,我在自己的开发机器上运行这个。我将DLL移动到我的框中,并在Visual Studio中引用它们。我想这是不可能的?是否有其他远程访问站点的选项?也许是网络服务?我的最终目标是从我们正在使用的集成软件中以编程方式将项目添加到SharePoint列表中。是的,web服务是以这种方式访问SharePoint的唯一方法。