@tomsd/sharepoint

v3.1.0

Published

SharePoint SOAP API wrapper

Downloads

17

Readme

@tomsd/sharepoint

Installation

npm install @tomsd/sharepoint

Usage

You can script in your HTML page placed on your SharePoint site.

import SharePoint from "@tomsd/sharepoint";
const siteurl = "https://[sharepoint.yoursite.com]/";
const sp = new SharePoint(siteurl);
sp.getLists().then(function(list){
  console.log(lists);
});
const listid = "xxxx-xxxx-xxxx-xxxx";
sp.getList(listid).then(function(list){
  console.log(list);
});
let spquery = sp.newquery().add("Eq","ID","Number",1).addviewfield("Title").setrowlimit(1);
sp.getListItems(listid, spquery).then(function(items){
  console.log(items);
});
// insert item
sp.upsertListItem(listid, {Title:"test"}).then(function(){
  console.log("inserted");
});
// update item with ID
sp.upsertListItem(listid, {ID:"1",Title:"updated title"}).then(function(){
  console.log("updated");
});
sp.removeListItem(listid, {ID:"1"}).then(function(){
  console.log("removed");
});