Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Filter List Items based on the Modified date

$
0
0

Hello Everyone,

I am trying to filter some list items based on there modified dates. My list contains about 67 columns. My environment is Office 365 i.e. SharePoint 2013 online and I am trying to fetch this records from an windows application build in VS 2013 and .Net framework 4.5

My Code is as follows :

ClientContext clientContext = new ClientContext(strContextURL);
clientContext.Credentials = new SharePointOnlineCredentials(strUsername, securePassword);
List oList = clientContext.Web.Lists.GetByTitle("Main");
CamlQuery camlQuery = new CamlQuery();
camlQuery.ViewXml = "<View><Query><Where><Gt><FieldRef Name='Modified'/><Value IncludeTimeValue='TRUE' Type='DateTime'>" + strDownloadDate + "</Value></Gt></Where></Query></View>";
ListItemCollection collListItem = oList.GetItems(camlQuery);
clientContext.Load(collListItem);
clientContext.ExecuteQuery();


 The value of strDownloadDate is 2016-08-17T02:22:22Z

But when clientContext.ExecuteQuery() runs it throws an error saying "The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator"

The Modified column (in SP List) contains values like 8/20/2016 12:58 AM like this.

Basically it will return 4 columns till now but instead it is throwing the above said error.

I also tried to run the CAML query in "SP CAML Query Helper Online" available in codeplex, there also it is throwing error saying "System.Web.Services.Protocols.SoapException: Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown. at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)  at SPCAMLQueryHelperOnline.SPWSLists.Lists.GetListItems(String listName, String viewName, XmlNode query, XmlNode viewFields, String rowLimit, XmlNode queryOptions, String webID) at SPCAMLQueryHelperOnline.WebServiceWork.ExecuteQuery.Worker()"

I searched a lot but everywhere it is done in the same manner. In MSDN forum also it is done in the same manner but in my case its not working.

I tried to make another custom DateTime column in that list with name WhenModified and tried to query the list against this column but it is also giving the same above specified error.

If anyone has any idea about it then please let me know.

Thanks & Regards.


Pradeep(PKM)


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>