Files
nicole 289769a601
Automatic Documentation Deployment / Sync Docs to https://kb.bunny-lab.io (push) Successful in 8s
Restructured Documentation
2026-09-05 14:08:43 -06:00

59 lines
2.2 KiB
Markdown

---
tags:
- Applications
- Access Another User OneDrive Data
---
## 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
```powershell
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)
```powershell
Get-SPOSite -IncludePersonalSite $true -Limit All
```
### Check OneDrive Usage of the Given User
```powershell
Get-SPOSite -Identity "https://<companyname>-my.sharepoint.com/personal/username_companyname_com" | Select Url, Owner, StorageUsageCurrent, StorageQuota, LastContentModifiedDate
```
### Assign Yourself Permissions to Their OneDrive
```powershell
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:
```powershell
Set-SPOUser `
-Site "https://<companyname>-my.sharepoint.com/personal/username_companyname_com" `
-LoginName "i:0#.f|membership|admin@companyname.com" `
-IsSiteCollectionAdmin $false
```
### Logout and Cleanup Auth Tokens and Remove Module
```powershell
Disconnect-SPOService
Remove-Module Microsoft.Online.SharePoint.PowerShell
# Close Powershell Window
```
## Related Documentation
- [Related Files and Collaboration Documentation](<../../../../reference/Applications/Files and Collaboration/index.md>) — Find the connected deployments, procedures, and references for this subject.