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

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

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
Solution Sage
Solution Sage

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.

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
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (1,391)