2

I am trying to run ClientContext.ExecuteQuery() and I am getting the following error message:

"The underlying connection was closed: A connection that was expected to be kept alive was closed by the server." >> "Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host."

My code is as follows:

ClientContext _clientcontext = new ClientContext("<URL of sharepoint site>");
NetworkCredential _cred = new NetworkCredential("userid", "password", "domain");
_clientcontext.Credentials = _cred;
Web _site = _clientcontext.Web;
CamlQuery _query = new CamlQuery();
try
{
    _query.ViewXml = <View><Where><Eq><FieldRef Name=\"Created\"/><Value         Type=\"DateTime\"><Today OffsetDays=\"-4\"/></Value></Eq></Where></View>";
    List _splist = _site.Lists.GetById(new Guid("<GUID>"));
    ListItemCollection _listitems = _splist.GetItems(_query);
    _clientcontext.Load(_listitems);
    _clientcontext.ExecuteQuery();
Spontifixus
  • 6,570
  • 9
  • 45
  • 63

0 Answers0