Hi All,
I am trying to get all the files which is modified or added yesterday from SharePoint document library using below code.
List list = clientContext.Web.Lists.GetByTitle(listName);
clientContext.Load(list);
clientContext.ExecuteQuery();
CamlQuery camlQuery = new CamlQuery();
camlQuery = new CamlQuery();
camlQuery.ViewXml =
"<View Scope='Recursive'>"
+ " <Query>"
+ " <Where>"
+ " <Geq>"
+ " <FieldRef Name='Modified' />"
+ " <Value Type='DateTime' IncludeTimeValue='False'>"
+ " <Today OffsetDays='" + ConfigurationManager.AppSettings.Get("OffsetDays") + "' />"
+ " </Value>"
+ " </Geq>"
+ " </Where>"
+ " </Query>"
+ "</View>";
ListItemCollection listCol = list.GetItems(camlQuery);
clientContext.Load(listCol);
clientContext.ExecuteQuery();
int cnt = listCol.Count;
foreach (var item in listCol)
{
TestingFiles(clientContext, item.FieldValues["FileDirRef"].ToString());
}
Please note that the value of OffsetDays is -1.
But with the above code I am getting all the files instead only yesterdays files. Any idea what went wrong in my code. Thanks in advance.