spfx-jsom
TypeScript icon, indicating that this package has built-in type declarations

0.6.6 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i spfx-jsom

Weekly Downloads

10

Version

0.6.6

License

MIT

Unpacked Size

50.4 kB

Total Files

8

Last publish

Collaborators

  • olemp2