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

file name modification with replace function

Started with a convert file to PDF template, and the "File name" property works fine. Then I want to make slight in-line change to filename, so I use the replace function, then attempt to use the same file name property as first argument of the function. it immediately switches to advanced mode with this text:
replace(triggerOutputs()['headers']['x-ms-file-name-encoded'],'.mht','')
The problem is that the reference does not return the value expected. I'm assuming the problem is the encoded variation, but I don't get a pick list, it just assumes i want encoded. How do I specify the (nice, readable) value that was used in the next part of the pipeline without the function?
1 ACCEPTED SOLUTION

Accepted Solutions
jrwarwick
Level: Powered On

Re: file name modification with replace function

Thanks for the fast reply, Zhongys. I was not clear, I am using SharePoint (not onedrive) trigger event "When a file is created or modified in a folder". Your suggestion may still work for that, I did not get around to trying it. Here is something that did work though:

 

  replace(base64ToString(triggerOutputs()['headers']['x-ms-file-name-encoded']),'.mht','__')
 
Just wrapping the triggerOutputs() call in a "base64ToString" call. It turns out this is exactly what the automatically dynamic content generated block/object was doing already, I just couldn't see it. I discovered it by using the peek option for the block. That is a goldmine when you get into this kind of situation, it seems. Thanks for your help all the same.

View solution in original post

2 REPLIES 2
v-zhos-msft
Level 10

Re: file name modification with replace function

Hi @jrwarwick ,

It seems you want to get the file name without extension.

I think you used the 'When a file is created' trigger in your flow.

Capture.PNG

I suggest you use the 'When a file is created (properties only)' trigger here.

Capture1.PNG

Best Regards,

Community Support Team _ Zhongys

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

jrwarwick
Level: Powered On

Re: file name modification with replace function

Thanks for the fast reply, Zhongys. I was not clear, I am using SharePoint (not onedrive) trigger event "When a file is created or modified in a folder". Your suggestion may still work for that, I did not get around to trying it. Here is something that did work though:

 

  replace(base64ToString(triggerOutputs()['headers']['x-ms-file-name-encoded']),'.mht','__')
 
Just wrapping the triggerOutputs() call in a "base64ToString" call. It turns out this is exactly what the automatically dynamic content generated block/object was doing already, I just couldn't see it. I discovered it by using the peek option for the block. That is a goldmine when you get into this kind of situation, it seems. Thanks for your help all the same.

View solution in original post

Helpful resources

Announcements
firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

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!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors
Users online (5,217)