Skip to main content

SharePoint Manager

License Version Latest release CI CodeQL Security

Python clients for SharePoint through Microsoft Graph. Version 0.1.x is an intentional breaking release from 0.0.x; see the 0.1.x contract.

Support contract

  • Python: 3.10–3.14
  • Runtime dependencies: httpx>=0.27,<1, msal>=1.37,<2, and requests>=2.33,<3
  • API: explicit operation targets, bounded by OperationPolicy, and typed with SP* exceptions
  • Authentication: confidential app registration credentials or an explicitly configured service-account username/password flow
  • Version: read from VERSION; 0.1.x does not preserve the 0.0.x API

The client does not grant end-user permissions. Configure Entra application permissions outside this package. Prefer Sites.Selected and grant only the required site and drive access; see deployment permissions.

Install

python -m pip install sharepoint-manager

For development and release tooling:

python -m pip install -e ".[dev]"

Builds use PEP 517:

python -m build --sdist --wheel

Quickstart

from sharepoint_manager import ClientCredential, SharepointManager

manager = SharepointManager(
    "https://tenant.sharepoint.com/sites/example",
    ClientCredential("client-id", "client-secret"),
    document_folder_name="Documents",
)

try:
    files = manager.list_files("Reports/2026")
    manager.download_file("summary.csv", "./downloads", "Reports/2026")
finally:
    manager.close()

Use with SharepointManager(...) as manager: when the manager owns its HTTP session. Never commit client secrets.

For a service account, configure the Entra app registration to allow public client flows and pass UserDelegatedCredential:

import os

from sharepoint_manager import SharepointManager, UserDelegatedCredential

manager = SharepointManager(
    "https://tenant.sharepoint.com/sites/example",
    UserDelegatedCredential(
        os.environ["SP_CLIENT_ID"],
        os.environ["SP_USERNAME"],
        os.environ["SP_PASSWORD"],
    ),
)

This username/password flow emits a warning because ROPC does not support MFA or Conditional Access. Do not persist the service-account password. It is used only for the initial MSAL token request; subsequent requests use the in-memory MSAL cache and silent acquisition. If the cache misses, create a new manager with the credentials. For managed identity, workload federation, certificates, or another provider, inject a TokenProvider with get_token(scope).

Operations and guarantees

  • Pass an explicit folder path, URL, or object to each operation. Managers have no mutable current-folder facade.
  • Downloads use a sibling temporary file, verify QuickXorHash when Graph supplies one, and replace the destination only after successful completion.
  • upload_file supports empty files and explicit fail, replace, or rename conflict behavior. An uncertain upload raises SPAmbiguousWriteError with recoverable session state.
  • iter_collection() yields bounded SPCollectionPage values lazily. iter_folder_delta() yields SPDeltaPage values containing files, folders, tombstones, and checkpoint links. Persist delta_link in the caller's store.
  • Approved SharePoint browser location URLs and sharing links support folder metadata, listing, creation, empty deletion, normalized permissions, and file transfers. Site/drive boundaries are checked before operations.

Limits, retries, and errors

Pass OperationPolicy to set finite file, byte, page, item, depth, disk, concurrency, retry, redirect, and wall-clock limits. Safe HTTP methods and resumable upload chunks use the bounded transport retry policy; non-idempotent Graph writes are not blindly replayed.

Catch stable public errors such as SPAuthenticationError, SPAuthorizationError, SPThrottledError, SPConflictError, SPFolderNotFound, SPFileNotFound, SPDriveNotFound, SPValidationError, SPDeadlineExceeded, and SPAmbiguousWriteError. Errors retain status, request ID, retryability, and the original cause without embedding credentials, capability URLs, or names.

Lifecycle and observability

Managers reuse one session and token provider and close owned resources through close() or context-manager exit. Request concurrency is bounded by the manager policy and each operation has an explicit target. Normal logs contain no bearer tokens, credentials, capability URLs, filenames, or permission members. Graph request IDs are retained as diagnostic fields. Pass telemetry=callback to receive privacy-safe graph.request, graph.page, transfer, and auth.token_refresh records with latency, status, retry, bytes, page/item, throttle, failure-class, and partial-outcome fields.

Development, migration, and support

See CONTRIBUTING.md for local checks and releases, SECURITY.md for security reporting, and CHANGELOG.md for version history. Use the explicit service-account flow described in the 0.1.x contract, or inject a delegated provider/service identity. Review the 0.1.x migration note before upgrading from 0.0.x.

Metadata

Release files for sharepoint-manager 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sharepoint-manager 0.1.1
File Size Uploaded Provenance
sharepoint_manager-0.1.1.tar.gz 38.2 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for sharepoint-manager 0.1.1
File Interpreter ABI Platform
sharepoint_manager-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 75.9 kB

Release files / sharepoint_manager-0.1.1.tar.gz

Download URL sharepoint_manager-0.1.1.tar.gz
Size 38.2 kB
Tags Source
SHA-256 checksum
How to use checksums
8bf5602d335241834d1872893ce7877f856fade79a7d6e21e454775b746cdc56
BLAKE2b-256 checksum
How to use checksums
76b2446fef61cc14ff4cfcef48c1e317e70562385a71b4b2bde0e936903fa278
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 25, 2026.

Transparency log

Release files / sharepoint_manager-0.1.1-py3-none-any.whl

Download URL sharepoint_manager-0.1.1-py3-none-any.whl
Size 37.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1a071de2d6f53ffdb5ceb73e55f3e5c6df4b386db6df3301284e9956d3d11146
BLAKE2b-256 checksum
How to use checksums
9adf4fa7e50ac8156dc147f54ee9cfda69c1a5f674f070b7858871893746d051
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 25, 2026.

Transparency log

Security for sharepoint-manager 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for sharepoint_manager-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page