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: Office365-REST-Python-Client, 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.2.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.2-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sharepointing-0.2.2.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.2.tar.gz
Algorithm Hash digest
SHA256 fbf9f8df96e8195cfffd90e6d24a77c51f97334caca4dd39e36b081a3e6a0932
MD5 eb94d84e924e21409385c6ecb988ecec
BLAKE2b-256 344d19ced0a332a506490e2872000888ee7b15bbe684c51c7430e34e1326d976

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sharepointing-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 5.3 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e022c17c4d0df7a5d574b96aa1c06bcb10ed733a7185e6786e82df977460a266
MD5 bb5425d1c1c17e955cb87f94c3b86866
BLAKE2b-256 4991897dd761294f2b1a9d1c37d2fae8de490adcee0877d69a67aa47a9f73398

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