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

Querying list items of document libraries returns incorrect values.

$
0
0

I have several document libraries. I am trying to get only the documents that the a selected user has however it is returning other authors documents. Attached is my code. Any help would be greatly appreciated.

CamlQuery camlQuery = new CamlQuery();
string query = "<View Scope='Recursive' /><ViewFields><FieldRef Name='File' /><FieldRef Name='FileLeafRef' /><FieldRef Name='LinkFilename'/><FieldRef Name='LinkFilenameNoMenu' /><FieldRef Name='Modified' /><FieldRef Name='Created' /><FieldRef Name='Author' /></ViewFields>" + "<Where><Eq><FieldRef Name='Author' LookupId='TRUE'/><Value Type='Integer'>" + user.Id + "</Value></Eq><AND><Eq><FieldRef Name='ContentType' /><Value Type='Computed'>File</Value></Eq></And></Where>" +"<OrderBy><FieldRef Name='Created' /><FieldRef Name='Modified' /></OrderBy><QueryOptions><RowLimit>" + count + "</RowLimit></QueryOptions></View>";

camlQuery.ViewXml = query;
listItems = list.GetItems(camlQuery);
clientContext.Load(listItems);
clientContext.ExecuteQuery();


Viewing all articles
Browse latest Browse all 7589

Trending Articles



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