cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jonw98
Helper I
Helper I

Stop sharing permission to a person for a SharePoint Library folder

Hi all,

 

I'm trying to find a way to stop sharing permission to a person for a SharePoint Library folder using Power Automate. Apparently "Stop sharing an item or a folder" is gone and the results I get from Google searches are only for SharePoint lists. I'm still kind of new to the REST API, so is there any way I can remove permission using Automate?

Thanks 🙂

6 REPLIES 6
JohnAageAnderse
Memorable Member
Memorable Member

Hello @jonw98 

 

I am not sure what you see, but I see the action "Stop sharing an item or a file" which is the one I use for any revoking of access.

Kind regards, John

Hi @JohnAageAnderse,

I'm trying to stop sharing for a folder, and I've tried using that action before and it does not work... 😞

Not sure if I was doing something wrong or it just doesn't work for folders.

abm
Super User
Super User

Hi @jonw98 

 

Believe you have custom permissions set for document library folders. It is possible to remove specified user from a particular document library folder using SharePoint REST API. Please follow the below steps.

 

Here I am using a manual trigger. First we need to find the user principal id. To find the id we need to know the user email address. Please see below.

 

image.png

 

Above JSON Schema is as follows:

 

{
    "type""object",
    "properties": {
        "d": {
            "type""object",
            "properties": {
                "__metadata": {
                    "type""object",
                    "properties": {
                        "id": {
                            "type""string"
                        },
                        "uri": {
                            "type""string"
                        },
                        "type": {
                            "type""string"
                        }
                    }
                },
                "Alerts": {
                    "type""object",
                    "properties": {
                        "__deferred": {
                            "type""object",
                            "properties": {
                                "uri": {
                                    "type""string"
                                }
                            }
                        }
                    }
                },
                "Groups": {
                    "type""object",
                    "properties": {
                        "__deferred": {
                            "type""object",
                            "properties": {
                                "uri": {
                                    "type""string"
                                }
                            }
                        }
                    }
                },
                "Id": {
                    "type""integer"
                },
                "IsHiddenInUI": {
                    "type""boolean"
                },
                "LoginName": {
                    "type""string"
                },
                "Title": {
                    "type""string"
                },
                "PrincipalType": {
                    "type""integer"
                },
                "Email": {
                    "type""string"
                },
                "Expiration": {
                    "type""string"
                },
                "IsEmailAuthenticationGuestUser": {
                    "type""boolean"
                },
                "IsShareByEmailGuestUser": {
                    "type""boolean"
                },
                "IsSiteAdmin": {
                    "type""boolean"
                },
                "UserId": {
                    "type""object",
                    "properties": {
                        "__metadata": {
                            "type""object",
                            "properties": {
                                "type": {
                                    "type""string"
                                }
                            }
                        },
                        "NameId": {
                            "type""string"
                        },
                        "NameIdIssuer": {
                            "type""string"
                        }
                    }
                },
                "UserPrincipalName": {
                    "type""string"
                }
            }
        }
    }
}
 
Next steps are get the user principal id and execute the rest api method to remove the user permissions from a particular folder. Below 'TestAjDocLib' is my document library and 'A1' is my folder name. 
 
image.png
 
My Test Result:
 
image.png
 
If you have any questions please let me know.
 
Thanks

 

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blogPower Automate Video Tutorials
abm
Super User
Super User

Hi @jonw98 

 

Do you need any further help in this?

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blogPower Automate Video Tutorials
caseyroot1
New Member

Hello, very helpful information!  I received a Bad Gateway on the http send DELETE method.  Any idea why?

Hi @caseyroot1 

 

Could you please post another thread and explain a little bit about your problem you trying to solve? Also a screenshot is very helpful.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blogPower Automate Video Tutorials

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (2,887)