1968c6db77
Automatic Documentation Deployment / Sync Docs to https://kb.bunny-lab.io (push) Successful in 4s
1.9 KiB
1.9 KiB
Purpose
You may find that you need to access data from a user's personal OneDrive account, and since that data cannot be accessed directly via Office365's Admin Portal, you have to do some legwork in Powershell.
Connect to Sharepoint
Install-Module Microsoft.Online.SharePoint.PowerShell
Import-Module Microsoft.Online.SharePoint.PowerShell
Connect-SPOService -Url https://<companyname>-admin.sharepoint.com # Login with your Office365 Admin Credentials when Prompted
Display List of Personal Sharepoint Sites (OneDrive)
Get-SPOSite -IncludePersonalSite $true -Limit All
Check OneDrive Usage of the Given User
Get-SPOSite -Identity "https://<companyname>-my.sharepoint.com/personal/username_companyname_com" | Select Url, Owner, StorageUsageCurrent, StorageQuota, LastContentModifiedDate
Assign Yourself Permissions to Their OneDrive
Set-SPOUser `
-Site "https://<companyname>-my.sharepoint.com/personal/username_companyname_com" `
-LoginName "i:0#.f|membership|admin@companyname.com" `
-IsSiteCollectionAdmin $true
Navigate to Webpage
At this point, you now have permissions to access the OneDrive data, so open a web browser and navigate to the SPOSite URL seen previously, seen below. From here, you can download, upload, and manage the data however you need.
https://<companyname>-my.sharepoint.com/personal/username_companyname_com
Remove Permissions
At this point, when the work is done, revoke your permissions to lock-down the OneDrive data once again by running the following command:
Set-SPOUser `
-Site "https://<companyname>-my.sharepoint.com/personal/username_companyname_com" `
-LoginName "i:0#.f|membership|admin@companyname.com" `
-IsSiteCollectionAdmin $false
Logout & Cleanup Auth Tokens & Remove Module
Disconnect-SPOService
Remove-Module Microsoft.Online.SharePoint.PowerShell
# Close Powershell Window