0.6.6 • Published 4 years ago
spfx-jsom v0.6.6
spfx-jsom
Use JSOM in SPFx with async-await
. spfx-jsom
takes care of loading the required SP libs.
Install
npm i spfx-jsom --save
Import using commonjs
import initSpfxJsom, { ExecuteJsomQuery, JsomContext } from "spfx-jsom";
Sample 1 - Get all web properties
async function getAllWebProperties() {
try {
const jsomCtx: JsomContext = await initSpfxJsom([SITE_URL]);
const webAllProperties = jsomCtx.web.get_allProperties();
await ExecuteJsomQuery(jsomCtx, [{ clientObject: webAllProperties }]);
return webAllProperties.get_fieldValues();
} catch (err) {
throw err;
}
}