# spfx-jsom

> Simplifies JSOM for SPFx

Latest version **0.6.6** (published 2020-01-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install spfx-jsom
pnpm add spfx-jsom
yarn add spfx-jsom
bun add spfx-jsom
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.6.6 |
| Published | 2020-01-17 |
| First published | 2018-02-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 49.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Maintainers | olemp2 |

## Links

- npm: https://www.npmjs.com/package/spfx-jsom
- Repository: https://github.com/olemp/spfx-jsom
- Homepage: https://github.com/olemp/spfx-jsom#readme
- Issues: https://github.com/olemp/spfx-jsom/issues
- npm.io page: https://npm.io/package/spfx-jsom

## Dependencies (2)

- [jsom-ctx](https://npm.io/package/jsom-ctx.md) ^1.2.1
- [@microsoft/sp-loader](https://npm.io/package/@microsoft/sp-loader.md) ^1.9.1

## Recent versions

- 0.6.6 (latest) — 2020-01-17
- 0.6.5 — 2020-01-17
- 0.6.4 — 2019-08-14
- 0.6.3 — 2019-08-14
- 0.6.2 — 2019-08-14
- 0.6.1 — 2019-08-14
- 0.6.0 — 2018-03-13
- 0.5.2 — 2018-03-13
- 0.5.1 — 2018-03-13
- 0.5.0 — 2018-02-02
- 0.3.0 — 2018-02-01
- 0.2.1 — 2018-02-01
- 0.2.0 — 2018-02-01
- 0.1.0 — 2018-02-01

## README

# spfx-jsom
Use JSOM in SPFx with `async-await`. `spfx-jsom` takes care of loading the required SP libs.

## Install
```powershell
npm i spfx-jsom --save
```

## Import using commonjs
```typescript
import initSpfxJsom, { ExecuteJsomQuery, JsomContext } from "spfx-jsom";
```

## Sample 1 - Get all web properties
```typescript
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;
    }
  }
```

---
_Source: https://npm.io/package/spfx-jsom · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
