New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

spsave

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

spsave

Save files in SharePoint using nodjs easily

0.0.4
Source
npm
Version published
Weekly downloads
4.3K
-6.4%
Maintainers
1
Weekly downloads
 
Created
Source

spsave

Nodejs module for saving files in SharePoint (both on premise and online).

###Install:

npm install spsave

###Usage:

var spsave = require("spsave");
spsave(options, callback);

###Options:

  • siteUrl - required, string url of the site
  • username - required, string user name
  • password - required, string password
  • folder - required, site-relative url to folder, which will be used to save your file. For example for library http://sp2013/sites/dev/SiteAssets folder will be equal SiteAssets, SiteAssets/subfolder for subfolder (but all folders should exist)
  • fileName - required, string file name
  • fileContent - required, string file content
  • domain - for on premise only, string domain name
  • workstation - for on premise only, string workstation name
  • isOnPrem - optional, function returns boolean, used to determine if the site is SharePoint online or on premise, default implementation - return (urlparse(url)).host.indexOf(".sharepoint.com") === -1;
  • log - optional, boolean to enable logging inside spsave, default is true
  • appWebUrl - optional, site-relative string url to your app web (for apps development). For example if your root web is http://sp2013.com/sites/dev and app full url is http://sp2013-apps.[guid].com/sites/dev/yourapp, then appWebUrl will be yourapp

###Callback Function which accepts error object as first argument and result of file upload as second.

###Samples Upload file file.txt to SharePoint online site into the SiteAssets library:

var spsave = require("spsave");

spsave({
	siteUrl: "https://[domain].sharepoint.com/sites/dev",
	username: "[user]@[domain].onmicrosoft.com",
	password: "[password]",
	folder: "SiteAssets",
	fileName: "file.txt",
	fileContent: "hello world"	
}, function(err, data){
	if(err){
		console.log("Error occurred");
	} else{
		console.log(data);
	}
});

SharePoint on premise version:

var spsave = require("spsave");

spsave({
	siteUrl: "[siteurl]",
	username: "[username]",
	password: "[password]",
	workstation: "[workstation name]",
	folder: "SiteAssets",
	fileName: "file.txt",
	fileContent: "hello world"	
}, function(err, data){
	if(err){
		console.log("Error occurred");
	} else{
		console.log(data);
	}
});

FAQs

Package last updated on 11 Sep 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts