Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Upload to Sharepoint

This Python script uploads a directory to SharePoint.

My preference was for a Node solution, but having I have tried various node libraries (e.g. spsave) they didn't work at the time of writing.

Prerequisites

This requires you to create an (Oauth2) App in SharePoint for your specific site. As far as I can see many of the URL appear hidden for this.

If you have a site https://committedio.sharepoint.com/sites/External/Shared Documents, visit:

<AppPermissionRequests AllowAppOnlyPolicy="true">
  <AppPermissionRequest Scope="http://sharepoint/content/sitecollection" Right="FullControl" />
</AppPermissionRequests>

See:

Usage

Install the dependencies:

pip3 install -r requirements.txt

Ensure you have the CLIENT_ID and CLIENT_SECRET for the Sharepoint App created above:

export CLIENT_ID=...
export CLIENT_SECRET=...

# Optional You may wish to rename / link / install sharepoint-upload.py somewhere for global use.

Now you can run

./sharepoint-upload.py --help

The majority of the options are for flexibility, and not required for general use.

### Examples

# Upload eveything under dist
./sharepoint-upload.py ./dist


# Upload just tar.gz under images
./sharepoint-upload.py ./images --files "*.tar.gz"

# Upload recursives all the *.ts under src
./sharepoint-upload.py ./src --files "**/*.ts"

# Upload a PDFs, but suffix the dir nane
./sharepoint-upload.py . --files "*.pdf" --name 'final-delivery'