我找到了连接SharePoint 2013 Service Pack 1的代码:
string siteUrl = "adress";
NetworkCredential credentials = new NetworkCredential("Username", "Password");
ClientContext clientContext = new ClientContext(siteUrl);
clientContext.Credentials = credentials;
Web site = clientContext.Web;
clientContext.Load(site);
clientContext.ExecuteQuery();
Console.WriteLine("Site information: nn");
Console.WriteLine("Title: {0}", site.Title);
Console.WriteLine("ID: {0}", site.Id);
Console.WriteLine("Language: {0}", site.Language);
Console.WriteLine("UI Version: {0}", site.UIVersion);
Console.WriteLine("Description: {0}", site.Description);
Console.WriteLine("Created: {0}", site.Created);
Console.ReadLine();
但是在这一行:
clientContext.ExecuteQuery();
我:
An unhandled exception of type 'System.Net.WebException' occurred in System.dll
Additional information: The remote server returned an error: (500) Internal Server Error.
网站工作良好,通过是ok的,我没有(至少看不到)问题与IIS,所以为什么我得到这个异常?
问题解决了,/deafult。