{"library":"msgraphfs","title":"Microsoft Graph Filesystem (msgraphfs)","description":"msgraphfs is a Python library that provides a filesystem-like interface to Microsoft Graph drives (SharePoint, OneDrive), built on top of `fsspec`. It enables seamless interaction with Microsoft 365 services, treating remote files and folders as if they were local. The current version, 0.4, introduces URL-based filesystem paths and enhanced multi-site access. The library appears to follow a release cadence driven by feature enhancements and bug fixes, with recent releases addressing usability and pagination.","language":"python","status":"active","last_verified":"Wed May 13","install":{"commands":["pip install msgraphfs"],"cli":null},"imports":["from msgraphfs import MSGraphFileSystem"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import os\nfrom msgraphfs import MSGraphFileSystem\n\n# Set environment variables for authentication (replace with your actual credentials)\n# Ensure your Azure AD app has 'Sites.Read.All' or 'Files.Read.All' permissions.\n# For more robust production, consider using a credential management system like Azure Key Vault.\nos.environ['MSGRAPHFS_CLIENT_ID'] = os.environ.get('MSGRAPHFS_CLIENT_ID', 'YOUR_CLIENT_ID')\nos.environ['MSGRAPHFS_TENANT_ID'] = os.environ.get('MSGRAPHFS_TENANT_ID', 'YOUR_TENANT_ID')\nos.environ['MSGRAPHFS_CLIENT_SECRET'] = os.environ.get('MSGRAPHFS_CLIENT_SECRET', 'YOUR_CLIENT_SECRET')\n\n# Initialize the filesystem for a specific SharePoint site and drive\n# Replace 'your_sharepoint_site' and 'your_drive_name' with actual values.\n# Alternatively, use URL-based paths directly, e.g., 'msgd://site/drive/path/file'.\ntry:\n    fs = MSGraphFileSystem(\n        protocol=\"sharepoint\",\n        site_name=\"your_sharepoint_site\",\n        drive_name=\"Documents\"\n    )\n\n    # List contents of the root directory\n    print(\"Listing root directory:\")\n    files = fs.ls(\"/\", detail=False)\n    for f in files:\n        print(f)\n\n    # Example: Check if a directory exists and create it if not\n    dir_path = \"/path/to/my/new_folder\"\n    if not fs.isdir(dir_path):\n        print(f\"Directory '{dir_path}' does not exist, creating it...\")\n        fs.mkdir(dir_path)\n        print(f\"Directory '{dir_path}' created.\")\n    else:\n        print(f\"Directory '{dir_path}' already exists.\")\n\n    # Example: Write a simple file\n    file_content = \"Hello from msgraphfs!\"\n    file_path = f\"{dir_path}/test_file.txt\"\n    print(f\"Writing to {file_path}...\")\n    with fs.open(file_path, \"w\") as f:\n        f.write(file_content)\n    print(f\"Content written to {file_path}.\")\n\n    # Example: Read the file\n    print(f\"Reading from {file_path}...\")\n    with fs.open(file_path, \"r\") as f:\n        read_content = f.read()\n    print(f\"Read content: '{read_content}'\")\n\nexcept Exception as e:\n    print(f\"\\nAn error occurred: {e}\")\n    print(\"Please ensure:\")\n    print(\"- Your MSGRAPHFS_CLIENT_ID, MSGRAPHFS_TENANT_ID, and MSGRAPHFS_CLIENT_SECRET environment variables are set.\")\n    print(\"- Your Azure AD application has the necessary API permissions (e.g., Sites.ReadWrite.All or Files.ReadWrite.All).\")\n    print(\"- 'your_sharepoint_site' and 'your_drive_name' are correct for your Microsoft 365 environment.\")\n","lang":"python","description":"This quickstart demonstrates how to initialize `MSGraphFileSystem` using Azure AD application credentials (client ID, tenant ID, client secret) provided via environment variables. It then performs basic filesystem operations like listing directories, creating a new directory, writing a file, and reading a file. An Azure AD application with appropriate permissions (e.g., `Sites.ReadWrite.All`) and correct site/drive names are crucial for successful execution.","tag":null,"tag_description":null,"last_tested":"2026-04-25","results":[{"runtime":"python:3.10-alpine","exit_code":1},{"runtime":"python:3.10-slim","exit_code":1},{"runtime":"python:3.11-alpine","exit_code":1},{"runtime":"python:3.11-slim","exit_code":1},{"runtime":"python:3.12-alpine","exit_code":1},{"runtime":"python:3.12-slim","exit_code":1},{"runtime":"python:3.13-alpine","exit_code":1},{"runtime":"python:3.13-slim","exit_code":1},{"runtime":"python:3.9-alpine","exit_code":1},{"runtime":"python:3.9-slim","exit_code":1}]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-13","installed_version":"0.3","pypi_latest":"0.4","is_stale":true,"summary":{"python_range":"3.10–3.9","success_rate":50,"avg_install_s":3.7,"avg_import_s":null,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"msgraphfs","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"44.9M"},{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"msgraphfs","exit_code":1,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"msgraphfs","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":4.1,"import_time_s":null,"mem_mb":null,"disk_size":"45M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"msgraphfs","exit_code":1,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"msgraphfs","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"48.4M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"msgraphfs","exit_code":1,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"msgraphfs","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":3.7,"import_time_s":null,"mem_mb":null,"disk_size":"49M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"msgraphfs","exit_code":1,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"msgraphfs","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"39.8M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"msgraphfs","exit_code":1,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"msgraphfs","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":3.3,"import_time_s":null,"mem_mb":null,"disk_size":"40M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"msgraphfs","exit_code":1,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"msgraphfs","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"39.2M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"msgraphfs","exit_code":1,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"msgraphfs","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":3.2,"import_time_s":null,"mem_mb":null,"disk_size":"40M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"msgraphfs","exit_code":1,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"msgraphfs","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"43.7M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"msgraphfs","exit_code":1,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"msgraphfs","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":4.4,"import_time_s":null,"mem_mb":null,"disk_size":"44M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"msgraphfs","exit_code":1,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null}]}}