Closed ghost closed 6 years ago
Hi @vpsrihari -
Yes, select is not available on the CAML query method as you make those specifications in the CAML itself. As for expands you can pass additional parameters to the method for expanding fields:
// as an example
list.getItemsByCAMLQuery(camlQuery, "Author/Email", "Author/Name");
HTH,
Patrick
Going to close this as answered, please reopen should you need to continue the conversation. Thanks!
has anyone had a successful test based on Patrick's response? I tried to use it to get CAML and Auth info, but got "Bad Request" Error. The code is below,
let list = web.lists.getByTitle(listName); return list.getItemsByCAMLQuery(CamlQuery,'Author/Name').then((res) => { ... }
The rest call URL looks like this, /sites/myside/_api/web/lists/getByTitle('Issues')/getitems?$expand=Author/Name HTTPS POST 400 application/json 1.05 KB 437 ms XMLHttpRequest 4618 218 141 78 0 0
There is also a valid post body to go along with this post request.
The library version I am using is, 3.0.2
Category
[X] Enhancement
[ ] Bug
[ ] Question
Version
Please specify what version of the library you are using: [ 3.0.4 ]
Expected / Desired Behavior / Question
Select and Expand methods are not available for getItemsByCAMLQuery method
Observed Behavior
Methods not available
Steps to Reproduce
Trying to use ODATA and CAML together as shown in the below article but seems like it cannot be used with sp-pnp-js. https://piyushksingh.com/2018/03/04/odata-expand-not-working-sharepoint-rest-api/
Thanks! Sri Hari