@tomsd/sharepoint
TypeScript icon, indicating that this package has built-in type declarations

3.1.0 • Public • Published

@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");
});

Readme

Keywords

Package Sidebar

Install

npm i @tomsd/sharepoint

Weekly Downloads

1

Version

3.1.0

License

MIT

Unpacked Size

96.3 kB

Total Files

9

Last publish

Collaborators

  • tomsd