Remove all shares from subfolders

Copper Contributor

Goodnight,

In my institution I have a folder (2021) that has many subfolders (departments, subdepartments, etc.).

I have assigned an Editor to each of these subfolders.

Afterwards, each Editor shared the folder of their respective departments and sub-departments with their collaborators.

Now, as the year is over and all processes are completed, I wanted to remove all shares: the problem is that there are hundreds!

Is there any way from the root folder (2021) to delete all shares in all subfolders at once?

Thanks :)

1 Reply
You can do it programmatically via CSOM or the Graph API, but you need to have some understanding of how to authenticate, the permissions required, etc. I published a "proof of concept" script a while back, feel free to edit it to better fit your scenario: https://www.michev.info/Blog/Post/3018/remove-sharing-permissions-on-all-files-in-users-onedrive-for...