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
Super User
Super User

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 III
Super User III

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 III
Super User III

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
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MSFTBizAppsLaunchEvent

Experience what’s next for Power Virtual Agents

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Users online (12,005)