Remove User from all Sharing Links of a SharePoint Online Document Library

Steel Contributor

I need to remove a user from a SharePoint document library. I already remove him from the team, but there are many Sharing Links which he can still use.


The library has more than 100000 documents, so it's not possible to go to each single document and check manually. There are also more then 1000 Sharing Links.


How can I completely remove the user from the document library?

2 Replies
Take a look a what you can do with the SharePoint Online API or PnP PowerShell cmdlets
Thank you! I am first trying to understand where all those permission might "hide". I think I have come across two places that need special care, after a user is removed from a SharePoint site:

1) SharingLinks: those are SharePoint member groups, which are connected to files and links.

2) Directly assigned permissions to files. Those seem not to be removed after removing a SharePoint member.

I would need to iterate those sets and remove the user if found inside. Are there any other places that I should look at?