Skip to content

dylanstetts/classifyShareURLs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

Classify Graph API Share URLs

This Python script helps developers and support engineers inspect and validate Microsoft Graph sharing links.

Features

  • Automatically acquires an app-only access token using MSAL.
  • Encodes and decodes sharing URLs to and from Graph-compatible shareId format.
  • Classifies shared resources (e.g., document, list item) based on URL patterns.
  • Calls the appropriate Microsoft Graph API endpoint (/driveItem or /listItem) based on classification.
  • Handles throttling (HTTP 429) and transient errors with retry logic.
  • Prints detailed metadata and item responses for inspection.

Requirements

  • Python 3.7+
  • requests
  • msal

Usage

Update the TENANT_ID, CLIENT_ID, and CLIENT_SECRET in the script. Input any sharing URLs you would like to test. Example:

shared_urls = [
    "https://yourdomain.sharepoint.com/:t:/s/ExampleSite/ExampleFile.txt",
    "https://yourdomain.sharepoint.com/sites/yoursite/Lists/yourlistitem"
]

Then run:

python testShares.py

Install dependencies:

pip install requests msal

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages