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 / Unable to save the fil...
Power Automate
Unanswered

Unable to save the file with correct name

(0) ShareShare
ReportReport
Posted on by 26

I have created a flow that saves attachments from incoming emails with specific filenames. For the filename, I've implemented an expression to extract the desired name. However, it's saving the file with unnecessary additional content, such as 

(trim(slice(triggerOutputs()?['body/body'], add(indexOf(triggerOutputs()?['body/body'], 'Brand:'), 6), add(add(indexOf(triggerOutputs()?['body/body'], 'Brand:'), 6), indexOf(slice(triggerOutputs()?['body/body'], add(indexOf(triggerOutputs()?['body/body'], 'Brand:'), 6)), 'Campaign:')))))

but its saving the file with some un-nessary thing that is Defined filename__span___strong___p___td___tr__tr__td style=_border_solid black 1.0pt; border-top_none; padding_.75pt .75pt .75pt red highlighted things are getting extra.

 

Despite my attempts to remove this extra content using string functions, the issue persists.

Categories:
  • Srini007 Profile Picture
    3,490 Super User 2026 Season 1 on at

    Hi @Narayandatta 

     

    Check below to get the only Defined filename, I tried as below

     

    Srini84_0-1694698871620.png

     

     

    1)  I use Intialize Variable action Name as originalString the value is what you have placed in post

    2)  Now use compose action select Expression and write as below 

    split(variables('OriginalString'), '__')[0]

     

    So above expression will split using '__' and take the value what is available in 0 index

     

    Now the compose output is as below

     

    Srini84_1-1694698914586.png

     

    If you find this reply helpful, please consider giving it a LIKE AND

    If this reply answers your question or solves your issue, please ACCEPT AS SOLUTION

     

    Thanks,

    Srini

     

     

     

  • Narayandatta Profile Picture
    26 on at

    I'm still getting the same file name. I'd like to provide you with more details. I am trying to create a file name using the following combination:

    "Mail received date + Specific information from mail body + Original attachment name (including the .xlsx extension)".

    This issue only occurs when I store the .xlsx file in SharePoint. I created another flow to test the same with subject name; When I receive an email meeting the same condition, I get an email with the subject line "Mail received date + Specific information from mail body + Original attachment name (including the .xlsx extension)," and it takes the correct subject line as desired.

      

  • Srini007 Profile Picture
    3,490 Super User 2026 Season 1 on at

    Hi @Narayandatta 

     

    Can you place some sample values for those combinations and also which one to pick as a filename

     

    Thanks,

    Srini 

  • Narayandatta Profile Picture
    26 on at

    I'm still getting the same file name. I'd like to provide you with more details. I am trying to create a file name using the following combination:

    "Mail received date + Specific information from mail body + Original attachment name (including the .xlsx extension)".

    This issue only occurs when I store the .xlsx file in SharePoint. I created another flow to test the same with subject name; When I receive an email meeting the same condition, I get an email with the subject line "Mail received date + Specific information from mail body + Original attachment name (including the .xlsx extension)," and it takes the correct subject line as desired.

    Narayandatta_1-1694706264724.png

     

    Narayandatta_0-1694706194650.png

     

  • Srini007 Profile Picture
    3,490 Super User 2026 Season 1 on at

    Hi @Narayandatta 

     

    The orginalString is a variable where you are getting the output of the required information which you need to extract. So, you need to change with your variable, not as same of mine

     

    Thanks,

    Srini

  • Narayandatta Profile Picture
    26 on at

    Getting this as a file name "MORE__span___strong___p___td___tr__tr__td style=_border_solid black 1.0pt; border-top_none; padding_.75pt .75pt .75pt .75pt___p__strong__span style=_font-family_"Calibri",sans-serif__WM_SMR_RECKITT BENCKISER HEALTHCARE INDIA PRIVATE LIMITED_714992"

    and i want only "MORE" as a file name, rest Date and attachment name taking correctly.

     

    for the Specific information from mail body i have created a below expression which will extract the desire information, if i keep in the mail body that also working correctly but in the attachment name its not working.

    Expression : trim(slice(triggerOutputs()?['body/body'], add(indexOf(triggerOutputs()?['body/body'], 'Brand:'), 6), add(add(indexOf(triggerOutputs()?['body/body'], 'Brand:'), 6), indexOf(slice(triggerOutputs()?['body/body'], add(indexOf(triggerOutputs()?['body/body'], 'Brand:'), 6)), 'Campaign:')))) 

     

  • Narayandatta Profile Picture
    26 on at

    I tried with both but still not getting as per expectition

  • Srini007 Profile Picture
    3,490 Super User 2026 Season 1 on at

    Hi @Narayandatta 

     

    Understood, Now, whatever expression you are keeping that keep in a Set variable and Name the variable as FileName

    Now put a compose and check this

     

    split(variables('FileName'), '__')[0]

    If you find this reply helpful, please consider giving it a LIKE AND

    If this reply answers your question or solves your issue, please ACCEPT AS SOLUTION

     

    Thanks,

    Srini

     

  • Narayandatta Profile Picture
    26 on at

    Still getting 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 321 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 271

#3
Henil Profile Picture

Henil 115

Last 30 days Overall leaderboard