Com 从客户端对象中的Sharepoint列表检索时转换日期字段

Com 从客户端对象中的Sharepoint列表检索时转换日期字段,com,sharepoint-list,sharepoint-clientobject,Com,Sharepoint List,Sharepoint Clientobject,我正在创建从sharepoint客户端对象模型加载列表项的windows窗体 我对日期字段存在问题,该字段给出+1天或-1天,即如果我输入的日期为2014年5月5日,则给出2014年5月6日,有时给出2014年5月4日 _query.ViewXml = "<View><Query><Where>" + "<And><Geq><FieldRef Name='Effort_x0020_Date'/>

我正在创建从sharepoint客户端对象模型加载列表项的windows窗体

我对日期字段存在问题,该字段给出+1天或-1天,即如果我输入的日期为2014年5月5日,则给出2014年5月6日,有时给出2014年5月4日

_query.ViewXml = "<View><Query><Where>" +
               "<And><Geq><FieldRef Name='Effort_x0020_Date'/><Value IncludeTimeValue='FALSE' Type='DateTime'>" + conStartDate + "</Value></Geq>" +
                    "<And><Leq><FieldRef Name='Effort_x0020_Date'/><Value IncludeTimeValue='FALSE' Type='DateTime'>" + conEndDate + "</Value></Leq>" +
                    "<Eq><FieldRef Name='Author' LookupId=’TRUE’/><Value Type=’Text’>" + UserID + "</Value></Eq></And></And></Where>" +
                    "<GroupBy  Collapse='TRUE'><FieldRef Name='WBS_x0020_Code'/></GroupBy></Query><RowLimit>25</RowLimit></View>";
SP.ListItemCollection _listitems = list.GetItems(_query);
clientcontext.ExecuteQuery();
\u query.ViewXml=“”+
“”+conStartDate+“”+
“”+conEndDate+“”+
“”+UserID+“”+
"25";
SP.ListItemCollection\u listitems=list.GetItems(\u查询);
clientcontext.ExecuteQuery();
执行此操作后,如果我使用下面的代码,它可以正常工作,但需要花费很多时间

 foreach(ListItem item in _listitems) {
     DateTime start = ((DateTime) item["Effort_x0020_Date"]);
     ClientResult < string > result = Utility.FormatDateTime(clientcontext, clientcontext.Web, start, DateTimeFormat.DateTime);
     clientcontext.ExecuteQuery();
     DateTime rightStart = Convert.ToDateTime(result.Value, new CultureInfo((int) web.Language));
     //item["Effort_x0020_Date"] = rightStart;
 }
foreach(listitems中的ListItem项目){
DateTime开始=((DateTime)项[“工作日”];
ClientResultresult=Utility.FormatDateTime(clientcontext,clientcontext.Web,start,DateTimeFormat.DateTime);
clientcontext.ExecuteQuery();
DateTime rightStart=Convert.ToDateTime(result.Value,newCultureInfo((int)web.Language));
//项目[“工作日”]=右开始;
}

不知何故,我希望有另一种方法可以更快地完成这项工作,从而避免每次连接到sharepoint。

我通过将

_query.DatesInUtc=false.

成功了

我通过将

_query.DatesInUtc=false.

成功了

我明白了,只需输入_query.DatesInUtc=false;它起作用了!!我明白了,只需输入_query.DatesInUtc=false;它起作用了!!