Skip to main content

Notifications

Community site session details

Community site session details

Session Id : oIJwUXoOvV7xqn64opXxcB
Power Automate - Building Flows
Unanswered

Remove all sharing links from all folders

Like (0) ShareShare
ReportReport
Posted on 2 Jan 2023 23:50:28 by 188

Hello! 

 

Using flow, 

  • Is it possible to remove ALL shared links from every single folder and file that's within a document library no matter how deep the tree is? OR
  • is there a setting that can be toggled that will turn off sharing (both internal and external) and will it delete all sharing links? OR
  • remove everyone, no matter what, except one account - a service account - so everyone loses access including shared links? 

EDIT: Many folder have unique permissions. 

 

the idea is to

1. set a site for archive - this is where i need to change "edit" to "read" access for everyone who is part of a group which i achieved but not with shared links as i am not sure how to remove it.

2. wait 7 days and move document library to a archive location (achieved) 

3. delete the site (acheived)

  • aniuafen Profile Picture
    17 on 27 Jul 2023 at 14:38:11
    Re: Remove all sharing links from all folders

    Will have it in mind, that's not a priority but defo will be done in couple of months!

  • geo-geo Profile Picture
    3 on 17 Jul 2023 at 15:34:50
    Re: Remove all sharing links from all folders

    Hello - I like your idea, but never used Power Automate. Could you please share the Power Automate script when ready and tested? Thanks

  • aniuafen Profile Picture
    17 on 04 Jul 2023 at 18:43:49
    Re: Remove all sharing links from all folders

    Hi, I am looking into the same challenge and what I am thinking of doing is using the usage report for SharePoint site (it is just under Site Usage and you request it and you receive email when it is done) and use it as a database of shared files and crawl through that. I have thousands of files to go through, but I might just mark on the spreadsheet (that's how the report is prepared) in one Power Automate step when the permissions will be revoked and use Do Until function with get items and and length function and Do Until the length of the batch is 0. 
    I will be preparing it so if you are interested I can save this page to share when it is ready.

  • rjack Profile Picture
    188 on 03 Jan 2023 at 18:23:58
    Re: Remove all sharing links from all folders

    @v-bofeng-msft 

    question: this "get files" will get every single file whether it is shared or not and "stop sharing", i assume, will run whether the file has sharing link or not. get files has number of returned file count limitation. some of our project document libraries are huge that exceed 10k files and/or folders and goes beyond 150 gb as well. 

     

    Could you make some suggestions on how i can get all files without limit (which is impossible) so i can run this step just once OR get only the files and folders that has sharing links on it - which can be done through batches if I can use filters? 

  • rjack Profile Picture
    188 on 03 Jan 2023 at 17:35:12
    Re: Remove all sharing links from all folders

    @v-bofeng-msft thanks! that's my plan b if i could not have a simpler solution to remove sharing permission to both folder and files at the same time - i was hopping for http request - in one step. with this get files and stop sharing solution, I need need 2 steps one for folder and the other for files. 

  • v-bofeng-msft Profile Picture
    on 03 Jan 2023 at 02:35:51
    Re: Remove all sharing links from all folders

    Hi @rjack ,

     

    You could use 'get files' list all files and use 'Stop sharing an item or a file' to stop sharing them.

    vbofengmsft_0-1672713258881.png

     

    Best Regards,

    Bof

     

     

    Best Regards,

    Bof

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - Building Flows

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 18 Super User 2025 Season 1

#2
stampcoin Profile Picture

stampcoin 16

#3
Churchy Profile Picture

Churchy 12

Overall leaderboard