Featured

Microsoft Teams Recursive Hierarchy Downloader - 2023

While I was doing an internship involving downloading many files with Python, I learned about asyncio and things got out of hand. Initially, I used it to speed up downloads from a locally hosted S3 storage server using Python's boto3 library. By switching over to aioboto3, we went from 60 files per second to averaging 800 files per second.

 

Before I started learning aioboto3, I was playing around with the Microsoft Teams API to try and map out my entire company's organizational chart. Microsoft Teams requests took multiple seconds, and I realized that running them in parallel didn't slow them down.

As a result, I parallelized my script to download an org chart from Microsoft Teams using Python's asyncio features, and this is the result I came up with.

I was interning at a relatively small company, so I tried this again with my college, and I had around 12,000 people in my chart. Unfortunately, the new Teams v2 from Microsoft comes with a new API, resulting in the above GitHub Gist being broken, as of 2024-10-29. Maybe I can update it soon, I looked into the API recently and it looks even simpler than before.

Related Articles