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

Community site session details

Session Id : yDMMNwwPTQExbKDUDrEu0c
Power Automate - Building Flows
Answered

file name modification with replace function

Like (0) ShareShare
ReportReport
Posted on 11 Jun 2019 18:49:04 by 14
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?
  • Verified answer
    jrwarwick Profile Picture
    14 on 12 Jun 2019 at 16:49:52
    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.
  • v-zhos-msft Profile Picture
    on 12 Jun 2019 at 02:54:50
    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.

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 2