Cannot get FileRef from getItemsByCAMLQuery method
Closed this issue · 1 comments
drewcook commented
Category
[ ] Enhancement
[x ] Bug
[ ] Question
Version
v1.1.0 - I am using the segmented pnp/sp library
Expected / Desired Behavior / Question
To have the FileRef property returned from a CAML query GET.
Observed Behavior
Does not return FileRef property.
Steps to Reproduce
import { sp } from "@pnp/sp";
The following will return an array of the items, but each one does not have the specified FileRef property:
const viewFields =
"<ViewFields>
<FieldRef Name='Alt_x0020_Text' />
<FieldRef Name='AlternateThumbnailUrl' />
<FieldRef Name='FileRef' />
<FieldRef Name='ID' />
<FieldRef Name='Title' />>
</ViewFields>";
const queryOptions = "<QueryOptions><ViewAttributes Scope='RecursiveAll'/></QueryOptions>";
sp.web.lists.getByTitle("Media").getItemsByCAMLQuery({
ViewXml: "<View>"+viewFields+camlQuery+queryOptions+"</View>"
}).then(media => { console.log(media); });
This should return a FileRef property just like a regular get() using select() would:
sp.web.lists.getByTitle("Media").items.select("Alt_x0020_Text", "AlternateThumbnailUrl", "FileRef", "ID", "Title").get().then(media => { console.log(media); });
The latter returns the FileRef with no issues. The former does not.