@wmfs/sharepoint
v1.19.0
Published
Trying to upload/list/download documents in Microsoft SharePoint, using Node.js
Downloads
3,780
Readme
sharepoint
Adventures in uploading/listing/downloading documents in Microsoft SharePoint Online... using Node.js
Getting Started
const Sharepoint = require('@wmfs/sharepoint')
const sp = new Sharepoint('URL HERE')
sp.authenticate()
sp.getWebEndpoint()
sp.getContents(path)
sp.createFolder(path)
sp.deleteFolder(path)
sp.createFile(options) // options = { path, fileName, data }
sp.deleteFile(options) // options = { path, fileName }
sp.createFileChunked(options) // options = { path, fileName, stream, fileSize, chunkSize }
Test
First, set these to match your SharePoint environment:
| Env Variable | Value |
| ------------ | ----- |
| SHAREPOINT_URL
| This is the site we're aiming for, so something like https://example.sharepoint.com/sites/YourSite/
|
| SHAREPOINT_USERNAME
| The username you want to connect to SharePoint with. Note this is the full username with an @
, so something like [email protected]
|
| SHAREPOINT_PASSWORD
| And yup, the password to accompany SHAREPOINT_USERNAME
. |
| SHAREPOINT_DIR_PATH
| Path to where the files are. e.g. /Shared Documents/General
|
- Alternatively, you can edit a
/.env
file if you prefer (as per dotenv)
Then, run:
npm run test