cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
CameronWilliams
Advocate II
Advocate II

Unable to create shareable links to SharePoint documents

Hi guys, I'm here with yet another Power Automate brain twister. 😅

 

I've been tasked with creating a form to facilitate update requests to our website. I went with a file upload-enabled Microsoft Form, but I quickly found out that the Form generates a folder on the SharePoint site and keeps whatever filename it had when the user submitted it. With many of our users guilty of naming files asdfgh.pdf, I began thinking of better means of renaming and storing these files.

 

I ended up developing some file renaming and moving logic into the Flow which is triggered by the Form submission. This is working flawlessly! Files that are submitted to the file upload folder are renamed to something easily sorted and recognizable as the user's file, then sorted into a new folder based on the user's department, display name, and the current date. The leftover files are then removed completely from the upload folder.

 

However, I ran into an issue. The flow is supposed to make the uploaded files easily accessed by the webmaster, so I went with the action to create a shareable link for each file. Firstly, I use a list folder action on the Identifier of the new user folder. Then, in an Apply to Each, I have the action for creating a shareable link based on the ID from the List Folder Body and a string variable to hold each URL. The problem is that this throws an error when it gets to the shareable link action.

The expression "sites('root')/lists('LIST ID')/items/%25252fShared%252bDocuments%25252fUpdate%252bRequest%252bDocuments%25252fDEPARTMENT%25252fDISPLAYNAME%25252fCURRENTDATE%25252fFILENAME.pdf/driveItem/createLink" is not valid.

I've omitted all sensitive information as all-capitalized words in the link.

 

While researching this error, I came across this thread. Because these IDs are variable in my flow example, they must be obtained from the list folder option. They cannot be hard coded such as in the thread I linked.

 

I know it is at least getting the right file, because the action is pulling the exact filename and displaying it in the error! Does anyone have any idea how to 1) decipher this error, and 2) resolve it? It is imperative that we have the shareable link action in this flow, as the alternative is a ridiculous number of replace statements...

 

The following is a visual representation of the flow:

 

Power Automate Shareable Link Issue.png

1 ACCEPTED SOLUTION

Accepted Solutions
CameronWilliams
Advocate II
Advocate II

Ah, yes, I'm the queen of resolving issues seconds after asking others about them. 😋

 

For those experiencing this issue, the way to resolve it is to put the shareable link action IMMEDIATELY after the create file action, and use the ItemID dynamic content from the create file action. It actually eliminated an entirely unnecessary apply to each from my flow.

 

Here is the visualization of this resolution:

Power Automate Shareable Link Issue RESOLVED.png

View solution in original post

2 REPLIES 2
CameronWilliams
Advocate II
Advocate II

Ah, yes, I'm the queen of resolving issues seconds after asking others about them. 😋

 

For those experiencing this issue, the way to resolve it is to put the shareable link action IMMEDIATELY after the create file action, and use the ItemID dynamic content from the create file action. It actually eliminated an entirely unnecessary apply to each from my flow.

 

Here is the visualization of this resolution:

Power Automate Shareable Link Issue RESOLVED.png

rohsh354
Community Support
Community Support

Hello,

 

Nice explanation !

 

Thanks for sharing the resolution. I am sure it can help other community members facing similar issues.

 

 

 

 

Helpful resources

Announcements
 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 (1,685)