cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
leizhaoyn
Level: Powered On

ThisItem.'Link to item' returns incorrectly formatted URL

Encountering a problem with using ThisItem.'Link to item' in a power app that's connected to a Sharepoint document libarary. The goal here is to use Launch(ThisItem.'Link to item') on a button OnSelect in order to open a PDF asset stored in the document library. The issue is that ThisItem.'Link to item' seems to return a URL (the filname part itself) that has incorrect character encoding, which leads to a page not found. Here's a couple examples:

 

Correct file name 

/Dog%20&%20Cat_Supplies_Safe%20Paw_SAFE%20PAW%20_%20Sell%20Sheet%20_%205%25%20Off%20-%20Purchase%20Pallet,%20Additional%205%25%20Off_02.28.2019_PA.pdf

 

What ThisItem.'Link to item' returns

/Dog%20%26%20Cat_Supplies_Safe%20Paw_SAFE%20PAW%20_%20Sell%20Sheet%20_%205%2525%20Off%20-%20Purchase%20Pallet,%20Additional%205%2525%20Off_02.28.2019_PA.pdf

 

In this case, "&" is getting encoded in ThisItem.'Link to item' to "%26", and an extra "25" appears after "5%25".

 

And yet, in the following example, ThisItem.'Link to item' correctly returns the following file name, leaving the "&" unencoded:

/Dog_Food%20&%20Treats_Natural%20Balance_NATURAL%20BALANCE%20_%20Sell%20Sheet%20_%20Rack%20Display_01.31.2019_FL.pdf

 

What gives here? I have no idea right now if this is a Sharepoint issue or Powerapps issue. Any guidance here would be most welcome.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: ThisItem.'Link to item' returns incorrectly formatted URL

Hi @leizhaoyn,

I have made a test on my side, and don't have the issue that you mentioned. The '&' character would not be converted into "%26" within the URL. The screenshot as below:1.JPG

As an alternative solution, please consider take a try to replace the "%26" and "%25" with nature character "&" and "%", and remove the extra '25' within the URL result the ThisItem.'Link to item' returned. I have made a test on my side, please take a try with the following workaround:

Substitute(Substitute(Substitute(ThisItem.'Link to item',"%26","&"), "%25", "%"), "25", "")

Set the OnSelect property of the "Launch" button to following:

Launch(Substitute(Substitute(Substitute(ThisItem.'Link to item',"%26","&"), "%25", "%"), "25", ""))

then check if the issue is solved.

If the issue still exists, I think there is something issue with the name format of your PDF file. Please consider take a try to rename your PDF file with a proper name (e.g. 'Dog-Cat_Supplies_Safe-Paw_SAFE-PAW... .pdf', replace space with '-').

 

More details about Substitute function in PowerApps, please check the following article:

Substitute function

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Community Support Team
Community Support Team

Re: ThisItem.'Link to item' returns incorrectly formatted URL

Hi @leizhaoyn,

I have made a test on my side, and don't have the issue that you mentioned. The '&' character would not be converted into "%26" within the URL. The screenshot as below:1.JPG

As an alternative solution, please consider take a try to replace the "%26" and "%25" with nature character "&" and "%", and remove the extra '25' within the URL result the ThisItem.'Link to item' returned. I have made a test on my side, please take a try with the following workaround:

Substitute(Substitute(Substitute(ThisItem.'Link to item',"%26","&"), "%25", "%"), "25", "")

Set the OnSelect property of the "Launch" button to following:

Launch(Substitute(Substitute(Substitute(ThisItem.'Link to item',"%26","&"), "%25", "%"), "25", ""))

then check if the issue is solved.

If the issue still exists, I think there is something issue with the name format of your PDF file. Please consider take a try to rename your PDF file with a proper name (e.g. 'Dog-Cat_Supplies_Safe-Paw_SAFE-PAW... .pdf', replace space with '-').

 

More details about Substitute function in PowerApps, please check the following article:

Substitute function

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

leizhaoyn
Level: Powered On

Re: ThisItem.'Link to item' returns incorrectly formatted URL

Hi Kris, thanks for the pointers on this. I've gotten the following function to produce the correct URLs:

Substitute(Substitute(ThisItem.'Link to item',"%26","&"), "2525", "25")

However, when placing this within a Launch function in the OnSelect property of the object like so:

Launch(Substitute(Substitute(ThisItem.'Link to item',"%26","&"), "2525", "25"))

Clicking the object doesn't do anything - yet there are no errors or warnings indicated. However, if I create a label with the first Substitute function, then go and copy/paste the resulting link in a new browser tab, it takes me to the correct asset. Any idea why the Launch function doesn't appear to be working properly here?

leizhaoyn
Level: Powered On

Re: ThisItem.'Link to item' returns incorrectly formatted URL

Thanks for your help! I believe this is now working. This was the formula that did it for me:

Launch(Substitute(Substitute(ThisItem.'Link to item',"%26","&"), "2525", "25"))

Thanks for your help pointing out how to use Subsitute in this context.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 446 members 6,121 guests
Please welcome our newest community members: