npm.io
0.0.16 • Published 10 years ago

sharepoint-promise

Licence
MIT
Version
0.0.16
Deps
2
Vulns
0
Weekly
0
DeprecatedThis package is deprecated

SharePoint Promise

A promise based wrapper around SharePoint's REST api

This project is under heavy development and is not recommended for use in production.

Installation

It's simple with npm:

npm i --save sharepoint-promise

Examples

Get a list
import SPPromise from 'sharepoint-promise'

SPPromise.getList('Contacts')
  .then((response) => {
    // do things
  })
Get list items
import SPPromise from 'sharepoint-promise'

SPPromise.getListItems('Contacts')
  .then((response) => {
    // do things
  })
Get a list item
import SPPromise from 'sharepoint-promise'

SPPromise.getListItemById('Contacts',1)
  .then((response) => {
    // do things
  })
Create a list item
import SPPromise from 'sharepoint-promise'

SPPromise.createListItem('Contacts',{Email:'test@example.com'})
  .then((response) => {
    // do things
  })
Update a list item
import SPPromise from 'sharepoint-promise'

SPPromise.updateListItem('Contacts',1,{Email:'newEmail@example.com'})
  .then((response) => {
    // do things
  })
Run a custom query
import SPPromise from 'sharepoint-promise'
// import some useful helper functions
import { json, log } from 'sharepoint-promise'

SPPromise.buildRequest('/some/api/path')
  .then(json) // gets the json body of the response
  .then(log) // logs the response

Keywords