cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bee-Xpert
Frequent Visitor

Get an existing sharing link from an item or folder in SharePoint with PowerAutomate

Hello,

 

I've created a flow which allow me to automate this process :

1) Create a "customer folder" in my SharePoint library

2) Sharing it to an external user with the block "Grant access to an item or a folder"

 

Then I would like to

3) Get the new "Sharing Link" from my Flow (manually accessible on right-click & "manage access" from the item on my SharePoint)

5) Save user e-mail & this "Sharing Link" to an Excel database

4) Send a custom e-mail (not the automatic one built on the block) with the new "Sharing Link"

 

But How to GET this new "Sharing Link" on my Flow after it has been created from the block "Grant access to an item or a folder".

 

I tried something like @{outputs('Grant_access_to_an_item_or_a_folder')?['body/link/webUrl']} but it's not working.

Maybe the solution is an HTTP request ?

 

Thanks,

 

Dylan Bergozza

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
MarvinBangert
Super User
Super User

Hi @bee-Xpert 

there is a way to get this information using a SharePoint action "Send an HTTP request to SharePoint":

Site Address: <Select your Site>

Method: "POST" (GET is not supported)

Uri: "/_api/web/lists/getbytitle('<Your Library Name>')/items(<Your Item ID>)/GetSharingInformation?$select=permissionsInformation&$Expand=permissionsInformation"

Headers:

AcceptApplication/json
Content-TypeApplication/json

 

This will give you an overview about the different permissions giving from that SharePoint item. Within "permissionsInformation"/"Links"/"linkDetails"/"Url" you will find the Url you generated from the action before.

 

You will find the invited user in "Invitations", to send a custom email, deactivate the "Notify recipients" within the "Grant access to an item or a folder" and just send an email using the "Office 365 Outlook" connector.

 

Does this help you? Otherwise please give me some more information.

Best regards
Marvin

If you like this post, give a Thumbs up. If it solved your request, Mark it as a Solution to enable other users to find it.

Blog: Cloudkumpel

View solution in original post

6 REPLIES 6
MarvinBangert
Super User
Super User

Hi @bee-Xpert 

there is a way to get this information using a SharePoint action "Send an HTTP request to SharePoint":

Site Address: <Select your Site>

Method: "POST" (GET is not supported)

Uri: "/_api/web/lists/getbytitle('<Your Library Name>')/items(<Your Item ID>)/GetSharingInformation?$select=permissionsInformation&$Expand=permissionsInformation"

Headers:

AcceptApplication/json
Content-TypeApplication/json

 

This will give you an overview about the different permissions giving from that SharePoint item. Within "permissionsInformation"/"Links"/"linkDetails"/"Url" you will find the Url you generated from the action before.

 

You will find the invited user in "Invitations", to send a custom email, deactivate the "Notify recipients" within the "Grant access to an item or a folder" and just send an email using the "Office 365 Outlook" connector.

 

Does this help you? Otherwise please give me some more information.

Best regards
Marvin

If you like this post, give a Thumbs up. If it solved your request, Mark it as a Solution to enable other users to find it.

Blog: Cloudkumpel

bee-Xpert
Frequent Visitor

Hi @MarvinBangert,

 

Thanks a lot ! That works perfectly.

 

The hardest thing was to Parse my JSON correctly because I got this error :

"Invalid type.  Expected String but not Null"

 

Adding "null" type to the JSON shema resolved this issue.

 

Now everything is perfect 👍

 

Thanks again.

Thank you @MarvinBangert -- you are a lifesaver!

AlexGran
New Member

Hi @MarvinBangert 

I'm kind of a rooky in Power Automate 😅

How can I get the URL from the body with json to put it in a mail ?

tgraham
Frequent Visitor

Hi @AlexGran , here's how I did it after reading other forums. After the HTTP Request, drill-down to information you want first, then Parse JSON. In the schema of the Parse JSON action, replace each "type": [ "string" ] with "type": [ "string", "null" ] then you'll be able to get what you need from the dynamic content picker.

 

tgraham_0-1664548161943.png

tgraham_1-1664548265791.png

 

 

Thanks @tgraham for your help but I don't have "Get sharing information" in my list 😭

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events happening this month - don't miss out!

 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Users online (4,457)