Last active
November 24, 2023 09:21
-
-
Save garrytrinder/766834a8c3b460bfb441f9e5be2bb52a to your computer and use it in GitHub Desktop.
Remove apps from Teams Developer Portal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Remove all apps from Teams Developer Portal | |
// 1. Open Teams Developer Portal (https://dev.teams.microsoft.com/apps) | |
// 2. Scroll down to the bottom of the page, loading all apps in the table | |
// 3. Open browser console (F12) | |
// 4. Manually delete one app from the table | |
// 5. Inspect the DELETE network request to get the bearer token | |
// 6. Paste this code into the console | |
// 7. Update the token variable with the bearer token | |
// 8. Run the code | |
(async () => { | |
let token = ''; | |
let ids = []; | |
document.querySelectorAll('[label="List of apps"]')[0] | |
.querySelectorAll('[role="row"]') | |
.forEach(x => ids.push(x.querySelectorAll('span.ui-text')[2].innerText)); | |
ids.shift(); | |
ids.forEach(id => | |
fetch(`https://dev.teams.microsoft.com/emea/api/appdefinitions/${id}`, | |
{ | |
method: 'DELETE', | |
headers: { | |
Authorization: `Bearer ${token}` | |
} | |
}) | |
.then(r => { | |
if (r.ok) console.log(`Deleted ${id}`) | |
}) | |
) | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment