Skip to content

drass/node-sharepoint-file-sharing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sharepoint file sharing

NodeJS server for Sharepoint download/upload.
This acts as a proxy between your API and Sharepoint, allowing you to download/upload files from Sharepoint without exposing your Sharepoint credentials to your API.
Tested in a production environment.

Features

  • Download files from Sharepoint
  • Upload files to Sharepoint

Usage

Download

To download a file from Sharepoint, send a GET request to /download with the following query parameters:

  • file - The file path in Sharepoint
  • folder - The folder path in Sharepoint

Upload

To upload a file to Sharepoint, send a POST request to /ask-to-upload with the following form data:

  • file_name - The file name, this will be passed to your defined API in order to get the file (e.g. yourapi.com/query={file_name})
  • file_title - The file title, this will be the title of the file in Sharepoint

Requirements

Development

To start the server run npm run start.
This will start the server on port 5000.

Docker

A docker image is available with Github packages and autogenerated on push to main.
You can pull the image with docker pull ghcr.io/drass/node-sharepoint-file-sharing:main.
Alternatively, you can use docker-compose to start the server.
Remember to set the environment variables in the docker-compose file, in the .env file or in the docker run --env command.

Configuration

The server can be configured with environment variables:

  • ORIGIN_DOMAIN - Your APIs origin domain for CORS
  • ORIGIN_API - You API path for the file upload withouth the domain (e.g. /api/v1/file). The file name will be appended to this path to get the file (e.g. yourapi.com/query={file_name})
  • SHAREPOINT_URL - Your Sharepoint URL, where the files will be uploaded to
  • SHAREPOINT_USER - Your Sharepoint username
  • SHAREPOINT_PASSWORD - Your Sharepoint password

License

The MIT license. Please see the LICENSE file for more details.

About

NodeJS server for Sharepoint download/upload

Resources

License

Stars

Watchers

Forks

Packages

No packages published