web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Get an existing sharin...
Power Automate
Answered

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

(0) ShareShare
ReportReport
Posted on by 8

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

 

 

 

Categories:
I have the same question (0)
  • Verified answer
    MarvinBangert Profile Picture
    1,924 Most Valuable Professional on at

    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 Profile Picture
    8 on at

    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.

  • tgraham Profile Picture
    73 on at

    Thank you @MarvinBangert -- you are a lifesaver!

  • AlexGran Profile Picture
    10 on at

    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 Profile Picture
    73 on at

    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

     

     

  • AlexGran Profile Picture
    10 on at

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

  • bee-Xpert Profile Picture
    8 on at

    Hi @AlexGran ,

    You misunderstood tgraham screenshots. The first block is a "Send an HTTP request to SharePoint" block renamed in "Get sharing information". 

     

    a.jpg

     

    To get a Sharing URL from a SharePoint element after the HTTP request, you need to "Parse JSON" from returned "body".

    For this you need a Parse JSON Schema. Here you have a description to get one from your flow answer : Where to get Schema for the Parse JSON action in Power Automate.

    Here is the simplified schema I made you can use to get only the url :

     

     

     

    {
     "type": "object",
     "properties": {
     "permissionsInformation": {
     "type": "object",
     "properties": {
     "links": {
     "type": "array",
     "items": {
     "type": "object",
     "properties": {
     "linkDetails": {
     "type": "object",
     "properties": {
     "Url": {
     "type": [
     "string",
     "null"
     ]
     }
     }
     }
     },
     "required": [
     "linkDetails"
     ]
     }
     }
     }
     }
     }
    }

     

     

     

     

    b.jpg

     

    Then, because there is many links for each element in SharePoint, you need to filter the links to get only those with a non-null URL. So use "Apply to each" on links from the previous Parse JSON, check if the URL is not null and send an e-mail.

     

    c.jpg

     

    And that's it, you will receive all Sharing links on the element one by one. I hope this is what you needed !

     

    Regards,

    Dylan

  • AlexGran Profile Picture
    10 on at

    Merci beaucoup Dylan,

     

    Thanks for your help!

    But with the schema that you published I'm not able to select the URL in the condition part. The URL is missing in the list.

     

    Bien à toi,

    Alex

     

     

  • gui_levcovitz Profile Picture
    7 on at

    @bee-Xpert , I followed your steps, but I can't find 'Url' in dynamic content in the e-mail corps step. Do you know why?

     

    gui_levcovitz_0-1666198989430.png

     

     

  • krzsztfk Profile Picture
    2 on at

    @gui_levcovitz , the issue seems to be connected to the URL type. I run into similar problem and managed to find a workaround (there must be a more proper way of doing it):

     

    In "Parse JSON", keep the type as string:

    [...]
     "Url": {
     "type": "string"
     }
    [...]

     

    It made the 'Url' available in dynamic content for me. After you're done with everything else, change the type back to:

    [...]
     "Url": {
     "type": [
     "string",
     "null"
     ]
     }
    [...]

     

    All subsequent references to 'Url' stay in place, and in my case, the flow runs as expected.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard