Question

I am building an SPFx Application Customizer for a Powell365 project, and trying to have it use custom properties from the current site collections's property bag.

I already managed to get these properties in SP PowerShell, using the code linked below. How can I access those values in my SPFx Applicaton Customizer, and what are the modules I need to import?

The code from PnP JS - SP Webs throws a Type error:

"Object does not support the property or method "from".

Any support will be appreciated! Please let me know if I can supply more information.

Get complex properties:

import { sp } from "@pnp/sp";
sp.web.select("AllProperties").expand("AllProperties").get().then(success=>{[...]},error=>
{[...]})

PowerShell Script: SharePoint Online: Get-Set Property Bag Values with PowerShell.

Was it helpful?

Solution

Looks like you are using this in Internet Explorer.

You need to use a polyfill to use this in IE 11.

You can download the package using npm install --save @pnp/polyfill-ie11 command.

After that, you can import it in your code as below:

import "@pnp/polyfill-ie11";
import { sp } from "@pnp/sp";
sp.web.select("AllProperties").expand("AllProperties").get().then(success=>{[...]},error=>
{[...]})

Reference - PnPJS polyfills

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top