Skip to main content

A basic sharepoint wrapper to be used with app-only credentials

Project description

Sharepoint Wrapper

Create Cofiguration

from sharepoint_wrapper import SharePointConfig

config = SharePointConfig(
    tenant="<tenant>",
    tenant_domain="<tenant_domain>",
    client_id="<client_id>",
    client_secret="<client_secret>",
    site="<site_name>",
)

Get Folders

from sharepoint_wrapper import get_folders

folders_at_root = get_folders(config)
# or 
# ensure your path starts with a slash "/"
folders_at_path = get_folders(config, "/my/path") 

Get Files

from sharepoint_wrapper import get_files

files_at_root = get_files(config)
# or 
# ensure your path starts with a slash "/"
files_at_path = get_files(config, "/my/path") 

Get File Content

from sharepoint_wrapper import get_file_content
from io import BytesIO

file_name = "my_file.pdf"

# returns a BytesIO file

file_at_root: BytesIO = get_file_content(config, file_name)
# or 
# ensure your path starts with a slash "/"
file_at_path: BytesIO = get_file_content(config, file_name, "/my/path") 

Upload a file

:warning: Note: Upload response will only be returned in case of success if upload fails, an exception will be raised

from sharepoint_wrapper import upload_file
from io import BytesIO

with open('path/to/your/file', 'rb') as file:
    file_content = file.read()

# Note: Upload response will only be returned in case of success
# if upload fails, an exception will be raised

upload_response: dict = upload_file(config, file_content, "file_name.txt")
# or 
# ensure your path starts with a slash "/"
upload_response: dict = upload_file(config, file_content, "file_name.txt", "/my/path") 

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

sharepoint_wrapper-0.0.4.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

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

sharepoint_wrapper-0.0.4-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file sharepoint_wrapper-0.0.4.tar.gz.

File metadata

  • Download URL: sharepoint_wrapper-0.0.4.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.9

File hashes

Hashes for sharepoint_wrapper-0.0.4.tar.gz
Algorithm Hash digest
SHA256 62dbac77678b4663a8fd08e8ebdf8283b3b7426598eb206e23bc1fbfff9d263d
MD5 11bcf791b12d79f671db0c369f60b846
BLAKE2b-256 1d3d1bf666dae45b7cd004e19d8c0050f72c6b4a9eb4381ad001ce5cbc0c4593

See more details on using hashes here.

File details

Details for the file sharepoint_wrapper-0.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for sharepoint_wrapper-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 8f8bca4c3ec5b4da4d22b1f23142253c694a31e18a65096ffc998075bf705c39
MD5 0692764987f1f5c71b53c7953d735185
BLAKE2b-256 22b3edb3a66c799189ab4c0b1cb4b1692f6ee754fd9e3c851e8e9913625a3b3c

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