Try changing your filter:
"Url -like '*-my.sharepoint.com/personal/'"
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I'm trying to delete OneDrive folder and subfoler (basically everything inside the folder) but I'm not sure how to get it done so I would be really appreciated if I can get any help or suggestion on how to do it.
Connect-SPOService -Url https://company-my.sharepoint.com/
$OneDriveURLs = Get-SPOSite -IncludePersonalSite $true -Limit All -Filter "Url -like '-my.sharepoint.com/personal/'"
foreach($OneDriveURL in $OneDriveURLs){
Connect-PnPOnline -Url $OneDriveURLs
Remove-PnPFolder -Name "Test" -Folder "Testing"
}
Try changing your filter:
"Url -like '*-my.sharepoint.com/personal/'"
and it's not my actual code
So post your actual code. Hehe. What folders does it find? What error do you get?
Or are you just completely lost because that snippet connects to a Sharepoint site, and I don't understand how you got OneDrive into Sharepoint! If you are using the personal OneDrive then this should list your files.
Get-ChildItem -Path "C:$($env:HOMEPATH)\onedrive" -recurse
Read this site!
Instead of writing your own code, have you tried this module? 2.2.8
It works for both the personal and business version of OneDrive.
Hi sorry. that was the example script that I found online and it's not my actual code. hehe