Skip to main content

A shared package for reading and writing to SharePoint

Project description

MPR-sharepoint-utils

Installing the package

pipenv install mpr-sharepoint-utils

Once the package is installed, you can use it like this:

from sharepoint_utils.lib import SharePointUtils

Using the package:

  • Useful methods are in the SharePointUtils class, which requires these arguments to connect to your SharePoint instance:
    • client_id, the ID portion of your user (or service) account credentials
    • client_secret, the secret string of your user (or service) credentials
    • site_id, the ID of the SharePoint site you wish to access
    • tenant, the name of your organization (you can find this in a SharePoint URL, like "tenant.sharepoint.com")

FAQs

Q: How do I know what my site ID is?

A: First, get your access token with the first command below; then, plug that into the second command below to get your site ID.

Get access token (can use to get site id given hostname and path (site/subsite)):

curl --location --request POST 'https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id=INSERT_CLIENT_ID' \
--data-urlencode 'scope=https://graph.microsoft.com/.default' \
--data-urlencode 'client_secret=INSERT_CLIENT_SECRET' \
--data-urlencode 'grant_type=INSERT_CLIENT_CREDENTIALS'

Get site ID

curl --location --request GET 'https://graph.microsoft.com/v1.0/sites/{hostname}:/sites/{path}?$select=id' \
--header 'Authorization: Bearer access_token' \
--data

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

mpr_sharepoint_utils-1.0.3.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

mpr_sharepoint_utils-1.0.3-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file mpr_sharepoint_utils-1.0.3.tar.gz.

File metadata

  • Download URL: mpr_sharepoint_utils-1.0.3.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for mpr_sharepoint_utils-1.0.3.tar.gz
Algorithm Hash digest
SHA256 636f2b61a73b683cf8d9f96738da6871b566f844c0f577d9495a4457c7c1cc2f
MD5 ed59832542bd2b1c0f14777605ad5c71
BLAKE2b-256 fb7d2c8c3491cbedbf1ebe4a90d3e8b3aea660e1c233e0b016c87024c355a577

See more details on using hashes here.

File details

Details for the file mpr_sharepoint_utils-1.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for mpr_sharepoint_utils-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4d30ac4cd2ada96c40d781951663c14a4b884d5d878e89acbdbd7fe062413e04
MD5 cd14a7c17af68ac9c68278e377c8d796
BLAKE2b-256 698bc300acd38b1d28fa6cffa28842a7c775a8905cb7110194104a1442fae375

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