How can I automate access to a leaver’s OneDrive?

0
9
Asked By CuriousCoder82 On

I'm looking for a way to automate granting access to a former employee's OneDrive. Managers often request this access frequently, and I want to streamline the process instead of doing it manually each time. I've written a PowerShell script that connects to Microsoft Graph to handle the user who has left, modify their mailbox to shared, and grant specified users access to OneDrive. However, I'm struggling with the command `New-MgSitePermission`. It fails with a 400 Bad Request error, and I'm not sure why. Could it be an issue with how I'm using the command, or is it a limitation in the API? I'd appreciate any help or insights on this!

1 Answer

Answered By TechSavvyJoe On

You could simplify things by making the manager a Site Collection Admin for the leaver's OneDrive using SharePoint PowerShell. Just use the `Set-SPOUser` command to give them admin access on the user's site. This way, they won’t need to wait for a manual process each time! Plus, if you're already automating, you can set up certificate-based authentication for SharePoint PowerShell too.

HelpfulHank93 -

That's a smart approach! I hadn't considered that. Just checking, is there any way to do this with Graph API instead? I want to avoid adding extra services for the helpdesk team.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.