SPServices icon indicating copy to clipboard operation
SPServices copied to clipboard

use <Method> in SPServices

Open FarshadRanaei opened this issue 5 years ago • 5 comments

I can't find any solution to write query like this in SPServices: <View> <Method Name="<The name of the Read List method which we edited to add the Filter>"> <Filter Name="<The name of the Filter>" Value='{0}'/> </Method> <Query> <Where> <Eq> <FieldRef Name='<Name of the Filter Field>' /> <Value Type='Number'>{0}</Value> </Eq> </Where> </Query> </View>

FarshadRanaei avatar May 21 '19 07:05 FarshadRanaei

That doesn't look like valid CAML to the SOAP (asmx) services.

sympmarc avatar Jun 05 '19 19:06 sympmarc

It's a valid caml. I implemented in csom but i can't use it in SPServices.

FarshadRanaei avatar Jun 08 '19 05:06 FarshadRanaei

As Mark indicated - it is not valid for the legacy SOAP API which SPServices still uses to interact with SharePoint. You are correct that it is ok for CSOM (or other more recent APIs) - the key here is that SPServices uses the SOAP API services which have not been updated in long time (sp2007?) and are considered legacy. I would suggest that you use the docs to refer to the old MS soap services documentation which should help get your CAML defined correctly.

My the way: it would help ALOT if you actually posted your JavaScript code that shows the call to SPServices so that we further understand what actual SOAP operation is being used. It also helps us to help you, by enable us to use that code to run quick tests to see if we can identify potential problems and suggest a solution.

Paul

-- sent from mobile

purtuga avatar Jun 08 '19 14:06 purtuga

Thanks Paul I want to get query from external list with specific parameter and i use csom like this: "<Method Name='GetItems'>"+ "<Filter Name='factorNumber' Value='"+Id+"'/>"+ "</Method>"+ "<Query>"+ "</Query>"+ "<ViewFields>"+ "<FieldRef Name='SendAmount'/>"+ "</ViewFields>"+ "</View>" which "GetItems" is my conection and "factorNumber" is filter that i get query based on that.

FarshadRanaei avatar Jun 11 '19 08:06 FarshadRanaei

You need to build it as a SOAP request (XML) and I think the method that needs to be used is the GetListItems... Here are some links that might help you:

  • SPServices helper page: https://github.com/sympmarc/SPServices/blob/master/docs/core/web-services/Lists/GetListItems.md
  • MS Help page - http://msdn.microsoft.com/en-us/library/lists.lists.getlistitems.aspx

If you happen to respond back to this thread - Please include your JS code that shows your setup to the SPServices $().SPServices({ operation: "GetListItems", CAMLQuery: "???" ... }) method. Its important that we see how you are actually settting the call along with your query.

purtuga avatar Jun 13 '19 14:06 purtuga