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.0.tar.gz (4.7 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.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sharepointing-0.2.0.tar.gz
  • Upload date:
  • Size: 4.7 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.0.tar.gz
Algorithm Hash digest
SHA256 729f293a710cd321ed125a504ad4e06e950fdb120975df38a27ff0d1983f9dee
MD5 92f97f2ccae98b97ada197b616045dfe
BLAKE2b-256 68d4d677aee324c332347d66b9163dc9a974479849711d92d3f15953e84b6135

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sharepointing-0.2.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8d2bd82775c0c65eb80019ce4a284138680ffa1fd033ffbaa462125f386aef5c
MD5 d6591449b0ce91897efbb872192c2ea3
BLAKE2b-256 c44918e84718fbb554bfb7df885a80059e5b86df0867f3f2ac711167adb32f48

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