share-zip-file-upload
v1.1.0
Published
SharePoint ZIP Uploader is a Node.js application that enables users to upload ZIP files directly to a SharePoint document library using the Microsoft Graph API. This project leverages Express.js for the server framework, Multer for handling file uploads,
Downloads
7
Readme
SharePoint ZIP Uploader
Overview
SharePoint ZIP Uploader is a Node.js application that enables users to upload ZIP files directly to a SharePoint document library using the Microsoft Graph API. This project leverages Express.js for the server framework, Multer for handling file uploads, and Axios for making HTTP requests.
Features
- Upload ZIP files to SharePoint document libraries.
- Simple REST API endpoint for file uploads.
- Validates file type to ensure only ZIP files are accepted.
Getting Started
Prerequisites
- Node.js and npm installed on your machine.
- A Microsoft Azure account with necessary permissions to access SharePoint.
- Your Azure application's
TENANT_ID
,CLIENT_ID
, andCLIENT_SECRET
.
Installation
Clone the repository:
git clone https://github.com/anishkumar127/Deploy-Zip-to-SharePoint-Library cd Deploy-Zip-to-SharePoint-Library
Install the dependencies:
npm install
Create a
.env
file in the root directory and add your configuration:PORT=3000 TENANT_ID=your-tenant-id CLIENT_ID=your-client-id CLIENT_SECRET=your-client-secret
Start the server:
npm start
The server will be running on
http://localhost:3000
.
API Endpoint
POST /upload
Uploads a ZIP file to SharePoint.
Request:
- Content-Type:
multipart/form-data
- Form data:
file
(required)
Response:
- 201 Created: If the upload is successful.
- 400 Bad Request: If no file is uploaded or if the file type is incorrect.
- 500 Internal Server Error: If there is an error during the upload process.
Example Usage
You can use tools like Postman or curl to test the file upload:
curl -X POST http://localhost:3000/upload -F 'file=@/path/to/yourfile.zip'
License
This project is licensed under the MIT License.