Script to delete Shared With Me links

Copper Contributor

Customer has a business requirement to delete all of a user's 'shared with me links' for compliance reasons.  Is there a way to do this with PowerShell and if so, can you point me to a sample script please?  Thanks in advance, Phil

3 Replies

here's an example script that gets that info for you:


Removing the links is not included there though, but it's a good starting point.

Thanks for the post.  Is this for OneDrive for consumer?  Having trouble getting it to work with OneDrive for Business.

it should work for both, in addition you can also use eDiscovery as the thread mentions. That'd give you a list of URL's to retrieve.