ClientContext.ExecuteQuery()生成连接错误消息

时间:2012-12-04 11:55:33

标签: c# sharepoint-2010

我正在尝试运行ClientContext.ExecuteQuery(),我收到以下错误消息:

  

“基础连接已关闭:服务器已关闭预期保持活动状态的连接。” >> “无法从传输连接读取数据:远程主机强行关闭现有连接。”

我的代码如下:

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();

0 个答案:

没有答案