@tomsd/sharepointrest
Installation
npm install @tomsd/sharepointrest
Usage
You can script in your HTML page placed on your SharePoint site.
// with bundler
import SharePointRest from "@tomsd/sharepointrest";
const siteurl = "https://[sharepoint.yoursite.com]/";
const sp = new SharePointRest(siteurl);
sp.getLists().then((lists) => console.log(lists));
sp.getList(listId).then((list) => console.log(list));
sp.getCurrentUser().then((user) => console.log(user));
sp.addList("listTitle").then((list) => {
sp.deleteList(list.Id);
});
sp.addList("listTitle").then((list) => {
sp.addField(list.Id, "text", "textField");
});
sp.getCurrentUser().then((user) => {
sp.sendMail(user.Email, [user.Email], "subject", "this is a test");
});