{"id":3274,"library":"shareplum","title":"SharePlum: Python SharePoint Library","description":"shareplum is a Python library designed to simplify interaction with Microsoft SharePoint sites. It provides functionalities for managing files, lists, and users, supporting various SharePoint versions. As of version 0.5.1, the library is actively maintained with a focus on API stability, particularly for file operations.","status":"active","version":"0.5.1","language":"en","source_language":"en","source_url":"https://github.com/jasonrollins/shareplum","tags":["sharepoint","microsoft","document management","api client","collaboration"],"install":[{"cmd":"pip install shareplum","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Handles HTTP communication with SharePoint APIs.","package":"requests"},{"reason":"Parses XML responses from SharePoint APIs.","package":"lxml"}],"imports":[{"symbol":"Site","correct":"from shareplum import Site"},{"symbol":"Version","correct":"from shareplum.site import Version"}],"quickstart":{"code":"import os\nfrom shareplum import Site\nfrom shareplum.site import Version\n\n# Use environment variables for sensitive data\nSHAREPOINT_URL = os.environ.get('SHAREPOINT_URL', 'https://yourcompany.sharepoint.com/sites/yourteam')\nSHAREPOINT_USERNAME = os.environ.get('SHAREPOINT_USERNAME', 'your_username')\nSHAREPOINT_PASSWORD = os.environ.get('SHAREPOINT_PASSWORD', 'your_password')\n\nif not all([SHAREPOINT_URL, SHAREPOINT_USERNAME, SHAREPOINT_PASSWORD]):\n    print(\"Error: Please set SHAREPOINT_URL, SHAREPOINT_USERNAME, and SHAREPOINT_PASSWORD environment variables.\")\n    print(\"Example: export SHAREPOINT_URL='https://yourcompany.sharepoint.com/sites/yourteam'\")\nelse:\n    try:\n        # Initialize the Site object with the SharePoint URL, username, password, and version\n        # Version.v365 is typically used for SharePoint Online (Office 365)\n        # The constructor handles authentication if username/password are provided\n        site = Site(SHAREPOINT_URL, username=SHAREPOINT_USERNAME, password=SHAREPOINT_PASSWORD, version=Version.v365)\n        \n        # Example: Get a list of all lists on the SharePoint site\n        all_lists = site.GetListCollection()\n        print(f\"Successfully connected to SharePoint at {SHAREPOINT_URL}.\")\n        print(f\"Found {len(all_lists)} lists:\")\n        for sp_list in all_lists:\n            print(f\"- {sp_list.get('Title')} (ID: {sp_list.get('ID')})\")\n\n    except Exception as e:\n        print(f\"An error occurred while connecting or fetching lists: {e}\")\n        print(\"Common issues:\")\n        print(\"1. Incorrect SHAREPOINT_URL (ensure it includes the full site collection path, e.g., /sites/yourteam).\")\n        print(\"2. Incorrect SHAREPOINT_USERNAME or SHAREPOINT_PASSWORD.\")\n        print(\"3. SharePoint site requires ADFS/MFA or other advanced authentication not supported by basic username/password.\")\n        print(\"4. Network issues or SharePoint API rate limits.\")","lang":"python","description":"Demonstrates how to connect to a SharePoint site using environment variables for credentials and retrieve a list of all available lists on the site. Highlights common issues and their troubleshooting."},"warnings":[{"fix":"Review the official `shareplum` documentation or GitHub examples for the updated Files API methods. Test file-related operations thoroughly after upgrading.","message":"The Files API was significantly updated and stabilized in version 0.5.0. Existing code interacting with file uploads, downloads, and management methods might break or require adjustments.","severity":"breaking","affected_versions":"< 0.5.0"},{"fix":"Consult your SharePoint administrator for the correct authentication method. shareplum primarily supports basic username/password; for more complex setups, you might need to handle authentication externally or use other tools like `MSAL.py` to obtain a bearer token, which `shareplum` can then use.","message":"SharePoint authentication can be complex, especially with ADFS, multi-factor authentication (MFA), or specific corporate security policies. Basic username/password authentication might not always suffice.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Double-check the exact SharePoint site URL in your browser. Ensure it includes any `/sites/` or `/teams/` segments if applicable to your site collection.","message":"Providing an incorrect SharePoint URL is a common mistake. The URL should typically include the full site collection path, e.g., `https://yourcompany.sharepoint.com/sites/yourteam`, rather than just the domain.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always pass the appropriate `version` parameter to the `Site` constructor. For SharePoint Online (Office 365), `Version.v365` is typically correct.","message":"It is crucial to specify the correct SharePoint `Version` enum (e.g., `Version.v365` for SharePoint Online) when initializing the `Site` object, as API behavior can differ between SharePoint versions.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}