web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / file name modification...
Power Automate
Answered

file name modification with replace function

(0) ShareShare
ReportReport
Posted on by 17
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?
Categories:
I have the same question (0)
  • v-zhos-msft Profile Picture
    Microsoft Employee on at

    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.

  • Verified answer
    jrwarwick Profile Picture
    17 on at

    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.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 552

#2
Valantis Profile Picture

Valantis 388

#3
11manish Profile Picture

11manish 375

Last 30 days Overall leaderboard