Process Pupil

CAML Query History List C#

I have some code on my developer machine that removes SharePoint tasks, history list items and items. I am using this query to find the history list items:

//Server Object Model CAML Query Syntax
SPList spList = spWeb.Lists.TryGetList("NintexWorkflowHistory");
if (spList != null) {
SPQuery query = new SPQuery();
query.Query = @"<Where
<FieldRef Name='Item' />
<Value Type='Integer'>1258</Value>
<FieldRef Name='List' />
<Value Type='Text'>614820ae-6ed2-4747-b69d-ba6347348100</Value>
SPListItemCollection listItems = spList.GetItems(query);


This returns nothing even though I can see there are 10 items in the history list that should be picked up.


If I remove the List value then I get the 10 results. I have run the query with the list value contining the squigglies and without them (as above) with no difference. If I use 'Contains' for th elist id in stead of equal I get 10 results (?!?)

I also boosted the throttle sizes for users and admins to 100,000 thinking that might be impeding it. No effect.


I'm using Saketa CAML Query Builder to verify my CAML. I'm stumped. Any ideas? I have to be able to use the primary liost value since the workflow publishers here do not always put their workflows into their own lists and I don't want to remove history for other lists that may have a matching item ID.

0 Kudos