Started working on SPFx and would like to develop an Image Rotator. As a first step, I wanted to get all the images and respective properties using PnP JS and used the following call and got the response:

return sp.web.lists.getByTitle('RotatorImages').select("Title", "Id", "TargetURL", "FileRef").items.get();

PnP JSON Response

As you can see above, I'm not able to locate the FileRef property and when I use conventional SharePoint REST API call, I'm able to get the property as shown below in the JSON Response.


JSON Response****************** <m:properties>

<d:Id m:type="Edm.Int32">Item ID: 2</d:Id>

<d:Title>Title: New Public Website Announcement</d:Title>

<d:TargetURL>Target URL: https://www.example.com/</d:TargetURL>

<d:FileRef>FileRef: /sites/dev/suhas/modernexperience/RotatorImages/New Public Web Site Announcement.png</d:FileRef>


Can someone please provide direction on how to get FileRef property using PnP JS from a Picture Library in SharePoint Online.

1 Answer 1


Please put .select(...) part after .items. This odata element is used to filter item properties.

sp.web.lists.getByTitle('listname').items.select("Title", "FileRef").get();

Reference doc: https://pnp.github.io/pnpjs/sp/items/


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.