Skip to main content

Python SharePoint Library

Project description

sharepoint4py

This is a continuation of deprecated project SharePlum from Jason Rollins

(THE DOCUMENTATION BELOW IS MOST FROM THE LEGACY LIBRARY AND WILL SOON BE UPDATED)

sharepoint4py 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 sharepoint4py 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', row_limit=200)

Authenticate to Office365 Sharepoint

::

from sharepoint4py import Site
from sharepoint4py 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', row_limit=200)

Access REST API

::

from sharepoint4py import Site
from sharepoint4py import Office365
from sharepoint4py.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 <http://sharepoint4py.readthedocs.org/en/latest/>_

Contribute

  • Issue Tracker <https://github.com/dianasoares/sharepy/issues>_
  • Source Code <https://github.com/dianasoares/sharepy>_

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

sharepoint4py-0.1.1.tar.gz (20.5 kB view details)

Uploaded Source

Built Distribution

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

sharepoint4py-0.1.1-py2.py3-none-any.whl (20.1 kB view details)

Uploaded Python 2Python 3

File details

Details for the file sharepoint4py-0.1.1.tar.gz.

File metadata

  • Download URL: sharepoint4py-0.1.1.tar.gz
  • Upload date:
  • Size: 20.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.8

File hashes

Hashes for sharepoint4py-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9ca5714a90dbd0ae21546765cdee69156c07b38be4d0525cc93d385ec46c397b
MD5 67a689ff3e624be5e4897083abec033c
BLAKE2b-256 8c686a118220264bb0cd9297b569f37f82b5a06d7f8426a7c9eb2e53557f3840

See more details on using hashes here.

File details

Details for the file sharepoint4py-0.1.1-py2.py3-none-any.whl.

File metadata

  • Download URL: sharepoint4py-0.1.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 20.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.8

File hashes

Hashes for sharepoint4py-0.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 3f3911cf08ba14b6709a49d45ab45b33c9b8fe640532f2869e24216b7e1f7725
MD5 db9d27770ba0d814569a3c11e81d6f03
BLAKE2b-256 71a9e16ebfd2646057887aacf0de330e18f3eaa5b6a497bf8a2de65ea666878a

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