Hi everyone! I'm running into a bit of a mystery and could really use your insights. I'm trying to execute a cmdlet to add a OneDrive URL to the exclusion list of a retention policy. I'm confident that the OneDrive URL is correct since I can open it and even add it manually through the policy's GUI. However, I keep getting this strange error message:
"AVERTISSEMENT : https://-my.sharepoint.com/:x:r/personal/ is not a valid SharePoint location."
The command seems to run successfully, but no settings in 'MyPolicy' have actually changed. Here's the command I'm using:
Connect-IPPSSession
Set-RetentionCompliancePolicy -Identity "MyPolicy" -RemoveOneDriveLocation "https://-my.sharepoint.com/:x:/r/personal/".
Any ideas on what might be going wrong?
1 Answer
It sounds like there might be an issue with the format of your OneDrive URL. Typically, OneDrive URLs look like this:
https://contoso-my.sharepoint.com/personal/user_contoso_onmicrosoft_com/
Make sure you're replacing "contoso" with your actual tenant name and "user" with the correct user object property for the SAMAccountName.
Also, if you need more details, there’s a helpful article here: https://learn.microsoft.com/en-us/sharepoint/list-onedrive-urls.
I also tried using this URL format, but it resulted in the same error.