pnp / pnpjs

Fluent JavaScript API for SharePoint and Microsoft Graph REST APIs
https://pnp.github.io/pnpjs/
Other
750 stars 306 forks source link

fetch _ColorHex property for each folder #2883

Closed mdissel closed 8 months ago

mdissel commented 8 months ago

What version of PnPjs library you are using

3.x

Minor Version Number

14

Target environment

SharePoint Framework

Additional environment details

SPFX

Question/Request

I'm trying to list all the subfolders of a parent folder AND return the ColorHex property. Any tips?

/_api/web/getFolderByServerRelativePath(decodedUrl='%2Fsites%2F221229%2F18123456789%2FXXXX')/folders?&$select=*,ListItemAllFields&$expand=ListItemAllFields

This returns all properties, but the ColorHex property is not returned.

see https://pnp.github.io/script-samples/spo-create-colored-folder/README.html?tabs=pnpps

bcameron1231 commented 8 months ago

Select the OData__ColorHex property

await sp.web.getFolderByServerRelativePath("/sites/Contoso/Files").folders.select('*,ListItemAllFields/OData__ColorHex').expand('ListItemAllFields')();

mdissel commented 8 months ago

Yes!! Thanks for the quick answer!

github-actions[bot] commented 8 months ago

This issue is locked for inactivity or age. If you have a related issue please open a new issue and reference this one. Closed issues are not tracked.