Last active
June 1, 2021 12:01
-
-
Save waldekmastykarz/e937172b270bcb84e86694012cfa0057 to your computer and use it in GitHub Desktop.
Removes all pending SharePoint API permission requests
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
#!/usr/bin/env zx | |
$.verbose = false; | |
console.log('Retrieving permission requests...'); | |
const permissionRequests = JSON.parse(await $`m365 spo sp permissionrequest list -o json`); | |
for (let i = 0; i < permissionRequests.length; i++) { | |
const request = permissionRequests[i]; | |
console.log(`Removing request ${request.Resource}/${request.Scope} (${request.Id})...`); | |
try { | |
await $`m365 spo sp permissionrequest deny --requestId ${request.Id}` | |
console.log(chalk.green('DONE')); | |
} | |
catch (err) { | |
console.error(err.stderr); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment