Hello!
I try get list from remote sharepoint server using CSOM in .NET Web Application, but ClientContext.ExecuteQuery() return exception Cannot contact site at the specified URL.If i try get list from local server all work fine. How fix it? Why an exception occurs?
I use follow code:
public string testRest()
{
try
{
ClientContext context = new ClientContext(new Uri(@"http://sharepointRemoteServer/sites/subsite"));
context.AuthenticationMode = ClientAuthenticationMode.Default;
context.Credentials = CredentialCache.DefaultNetworkCredentials;
List spList = context.Web.Lists.GetByTitle("ListName");
context.Load(spList);
context.ExecuteQuery();
return "OK";
}
catch (Exception ex)
{
return ex.Message;
}
}