v1
$onedriveUrl = "https://namdarrealty-my.sharepoint.com/personal/user_domain_com" $tenant = "tenant.onmicrosoft.com" $clientid = "**get this from checking the application in Entra**" # install-module pnp.powershell -scope allusers # Register-PnPEntraIDAppForInteractiveLogin -ApplicationName "PnP.PowerShell" -Tenant $tenant Import-Module PnP.PowerShell # sign in as the user (could be with TAP) Connect-PnPOnline -Url $onedriveUrl -Interactive -ClientID $clientid Get-PnPRecycleBinItem -secondstage | Restore-PnpRecycleBinItem -Force
v2 excluding folders (since they should get recreted
$onedriveUrl = "https://namdarrealty-my.sharepoint.com/personal/user_domain_com" $tenant = "tenant.onmicrosoft.com" $clientid = "**get this from checking the application in Entra**" # install-module pnp.powershell -scope allusers # Register-PnPEntraIDAppForInteractiveLogin -ApplicationName "PnP.PowerShell" -Tenant $tenant Import-Module PnP.PowerShell # sign in as the user (could be with TAP) Connect-PnPOnline -Url $onedriveUrl -Interactive -ClientID $clientid Get-PnPRecycleBinItem -secondstage | Where-Object { $_.ItemType -eq "File"} | Restore-PnpRecycleBinItem -Force
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article