Hello CodePlex Users,
I am trying to filter the items from a list based on the current user; I started playing around with this script:
<script language="javascript" type="text/javascript"> $(document).ready(function() { $().SPServices({ operation: "GetListItems", async: false, listName: "Sites", CAMLQuery: "<Where><Eq><FieldRef Name='UserName'/><Value Type='Integer'><UserID Type='Integer'/></Value></Eq></Where>", CAMLQueryOptions: "<QueryOptions><ViewAttributes Scope='RecursiveAll' IncludeRootFolder='True' /></QueryOptions>", CAMLViewFields: "<ViewFields><FieldRef Name='SiteName' /><FieldRef Name='UserName' /><FieldRef Name='Title' /></ViewFields>", completefunc: function (xData, Status) { $(xData.responseXML).SPFilterNode("z:row").each(function() {var liHtml = "+ $(this).attr("ows_SiteName") + ""; $("#tasksUL").append(liHtml); }); } }); });</script>
<ul id="tasksUL"/>
However it doesn’t bring the items up, when I eliminate the Query and Query options, it does extract every item, my guess is that my query is not correct, can someone more experienced give me a hand? It will be highly appreciated.
↧
New Post: Operation GetListItems is not working when I insert the CAML query to filter the options.
↧