1

I have files in SharePoint that have a custom lookup column referencing a list "Document Status".

Using PnP.js, I can get the files under a folder

sp.web.getFolderByServerRelativeUrl("/sites/mysite/mylib/docs").files.expand('ListItemAllFields').get();

It only returns the ID column of the "Document Status" list, but I want to get the Title column of the list. I know probably I can iterate through each file and do another query to get the Title of the lookup value. Is there a better way to get the column(s) of the lookup list? Are there any SharePoint settings I need to change?

user3616544
  • 1,023
  • 1
  • 9
  • 31

1 Answers1

1

You could expand the property like this:

sp.web.getFolderByServerRelativeUrl("/sites/test/doc2").files.expand('ListItemAllFields/FieldValuesAsText').get()
Michael Han
  • 3,475
  • 1
  • 6
  • 8