Skip to content

olemp/spfx-jsom

Repository files navigation

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;
    }
  }

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published