Paul,
Using the JSOM for this is hard work.
I would fire off a REST request like this:
https://tenant.sharepoint.com/_vti_bin/listdata.svc/ListName/$count?$filter=Field
eq Value
You should get back just the number of rows that match the filter. No XML or
JSON to worry about – just a number.
Cheers,
J
[cid:[email protected]]
James Boman | Product Lead
• T: +61872001100<callto:+61872001100> • M: +61417857298<callto:+61417857298>
From: [email protected] [mailto:[email protected]] On Behalf Of
Paul Noone
Sent: Wednesday, 25 November 2015 11:04 AM
To: ozMOSS <[email protected]>
Subject: CSOM - Syntactic issue with retrieved CAML query from list view
Hi all,
Long time no speak! :)
I'm trying to retrieve the number of list items in a specified list view via
JavaScript.
The problem is that the get_viewQuery method does not return a valid CAML query.
What it returns is:
<OrderBy>\
<FieldRef Name="Modified" Ascending="FALSE" />
</OrderBy>
<Where>
<Eq>
<FieldRef Name="Author" />
<Value Type="Integer"><UserID Type="Integer" /></Value>
</Eq>
</Where>
What I need is:
<View>
<OrderBy>\
<FieldRef Name="Modified" Ascending="FALSE" />
</OrderBy>
<Query>
<Where>
<Eq>
<FieldRef Name="Author" />
<Value Type="Integer"><UserID Type="Integer" /></Value>
</Eq>
</Where>
</Query>
</View>
Apparently this issue also applies to C#.
The only solution I've found is to wrap the returned CAML like so:
viewQuery = String.format("<View><Query>{0}</Query></View>",
view.get_viewQuery());
But this is limited and not does not allow for OrderBy, ViewFields and other
possibilities.
Has anyone hit this before and found a viable solution?
Cheers,
Paul
_______________________________________________
Sponsored by Infotext - Amazing Search for Microsoft SharePoint -
http://www.infotext.com/
ozmoss mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss