Skip to main content

A package to establish a connection to SharePoint site, and upload files through that connection

Project description

Sharepointing

A library to establish connection to sharepoint. Then operate on this connection. Right now it's only possible to upload files.

This library depends on office 365 library, and it will use active directory authentication to connect to SharePoint.

Installation

In order to install this library you need to obtain an SSH code

Use pip to install this library from Github:

pip install sharepointing

Requirements

First you need to initialize the the sharepoint connection, which is an object. You have two options, either use embedded credentials in environment variables:

USERNAME for office365 email

PASSWORD for office365 password

Then you can use this call:

sp = sharepointing.sp_site(site_url)

The second option is to provide the credentials in the class call:

sp = sharepointing.sp_site(site_url,username,password)

Once the object is created successfully, you can call use upload_file method to upload the files to sharepoiont

decode_link function

This function will take any full link from SharePoint and can give back two two options 1 > The site_url 2 > The target folder 3 > Both as list Instructions: Using your browser, open your SharePoint site and navigate to the target folder Copy the link from the browser, and provide it here.

Example 1 - upload_file

site_url = "https://companysite.sharepoint.com/teams/teamsname"
target = "/teams/teamsname/Shared Documents/General/"
file = 'file.txt'
sp = sharepointing.sp_site(site_url)
sp.upload_file(file,target)

Example 2 - decode_link

full_link = "https://companysite.sharepoint.com/teams/teamsname/Shared%20Documents/Forms/AllItems.aspx?id=%2Fteams%teamsname%2FShared%20Documents%2FGeneral%2FSales%20Management%2F99%2E%20Resources%2F02%2E%20First%20Region&viewid=ecdf0311%2De700%2D4d9b%2Db7d3%2D6eaecaf18c76"
site_url = decode_link(full_link,1)
target = decode_link(full_link,2)

Example 3 - download_file

# Get the target url of where file is
sp_url = "https://excellentproject.sharepoint.com/teams/MarketingTeam/Shared%20Documents/Forms/AllItems.aspx?id=%2Fteams%2FMarketingTeam%2FShared%20Documents%2FGeneral%2FMarketing%20Reports%2Fdata&viewid=ecdf0311dddd9dbddd7d3%2Dddddddsad"

# Extract the site url and the target folder
site_url,target_folder = decode_link(sp_url,3)

# Define the file name 'myfile.csv' and construct its full path
remote_file = os.path.join(target_folder,'myfile.csv')

# Local folder path, can be referring to anything
local_folder = ""

# Initialize the SharePoint site object
sp = sp_site(site_url)

# Execute the recieve
sp.download_file(remote_file,local_folder)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sharepointing-0.2.1.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sharepointing-0.2.1-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file sharepointing-0.2.1.tar.gz.

File metadata

  • Download URL: sharepointing-0.2.1.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for sharepointing-0.2.1.tar.gz
Algorithm Hash digest
SHA256 11b907a269874ebb156c1662a76feb28bb3c92874bc05ac580eda65f206a4b1d
MD5 d66de598a1323f0548505ed54b65f67c
BLAKE2b-256 5611ee6f23b7b6bbd11a9be1c2b8208b0399e61b97a65d0126f6e5f75f1b493a

See more details on using hashes here.

File details

Details for the file sharepointing-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: sharepointing-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for sharepointing-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bca8cb8f7866c165e8cf96451037480c09a2716df2d03eb15784b79646c7c75b
MD5 c7a7a7b4ed654164f338e5f7c49e7531
BLAKE2b-256 483ea008f5c4c02e2145932d0a33e8ddc233b2d4161c4dda257b3a507a5c6aa0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page