Skip to main content

Python SharePoint Library

Project description

SharePlum is an easier way to work with SharePoint services. It handles all of the messy parts of dealing with SharePoint and allows you to write clean and Pythonic code.

Usage

from shareplum import Site
from requests_ntlm import HttpNtlmAuth

auth = HttpNtlmAuth('DIR\\username', 'password')
site = Site('https://abc.com/sites/MySharePointSite/', auth=auth)
sp_list = site.List('list name')
data = sp_list.GetListItems('All Items', rowlimit=200)

Authenticate to Office365 Sharepoint

from shareplum import Site
from shareplum import Office365

authcookie = Office365('https://abc.sharepoint.com', username='username@abc.com', password='password').GetCookies()
site = Site('https://abc.sharepoint.com/sites/MySharePointSite/', authcookie=authcookie)
sp_list = site.List('list name')
data = sp_list.GetListItems('All Items', rowlimit=200)

Access REST API

from shareplum import Site
from shareplum import Office365
from shareplum.site import Version

authcookie = Office365('https://abc.sharepoint.com', username='username@abc.com', password='password').GetCookies()
site = Site('https://abc.sharepoint.com/sites/MySharePointSite/', version=Version.v2016, authcookie=authcookie)
folder = site.Folder('Shared Documents/This Folder')
folder.upload_file('Hello', 'new.txt')
folder.get_file('new.txt')
folder.check_out('new.txt')
folder.check_in('new.txt', "My check-in comment")
folder.delete_file('new.txt')

Features

  • Reading and writing data to SharePoint lists using Python Dictionaries.

  • Automatic conversion between SharePoint internal names and displayed names.

  • Using Queries to filter data when retrieving List Items.

  • Automatic conversion of data types.

  • Supports Users datatype.

  • Supports Office365 Sharepoint sites.

  • Supports Folder and File operations with the REST API. (Requires SharePoint 2013 or newer)

Documentation

Read the Docs

Contribute

Unit Tests

This package uses python unittest. To run the unit tests, first copy tests/test_settings.py as tests/local_test_seetings.py and edit the contents to point at your sharepoint. Second export your sharepoint password as an environment variable ‘TEST_PASSWORD’ Then from the root folder run:

python -m unittest disover  # all tests
python -m unittest tests.test_site  # all site tests

License

This project is licensed under the MIT license.

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

SharePlum-0.5.1.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

SharePlum-0.5.1-py2.py3-none-any.whl (25.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file SharePlum-0.5.1.tar.gz.

File metadata

  • Download URL: SharePlum-0.5.1.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1

File hashes

Hashes for SharePlum-0.5.1.tar.gz
Algorithm Hash digest
SHA256 07a45d48920450092e56c33846fe17768d4611dc83a7314ef0140e57dee52966
MD5 d91c6ea36ac9bbcda99aa46f01b83b74
BLAKE2b-256 db862152ac9cc7230fa7d5b93b4f9e0776773f4959a4f1a2f9ca4622dae932c8

See more details on using hashes here.

File details

Details for the file SharePlum-0.5.1-py2.py3-none-any.whl.

File metadata

  • Download URL: SharePlum-0.5.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 25.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1

File hashes

Hashes for SharePlum-0.5.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e7450aafeb84d529f8fba2cac7057ab393ad921c4596ac411cf1c84af1a48a68
MD5 1a090aebacb4dfac41c26ed2a4db0c77
BLAKE2b-256 4e13665e4610516dcb28aaf1c085ef94dc01da99a813c96491ddd29074b896d9

See more details on using hashes here.

Supported by

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