cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
leizhaoyn
Frequent Visitor

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
v-xida-msft
Community Support
Community Support

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
v-xida-msft
Community Support
Community Support

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

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?

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
PA 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

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (45,281)