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 / rename attachment befo...
Power Automate
Answered

rename attachment before saving it into onedrive

(0) ShareShare
ReportReport
Posted on by 32

here is Copilot text to show what my flow is doing .

 

his flow is triggered when a new email is received from "x@x.x" with any importance. It checks if the email contains attachments and if the attachment name starts with "Facture". If the email body contains "ANP-DAKHLA" and does not contain "REGLEE", it creates a file in the "/Documents/factures ANP/dakhla" folder. If the email body contains "TANTAN" and the attachment name starts with "Facture", it creates a file in the "/Documents/factures ANP/tantan" folder. If the email body contains "ANP-LAAYOUNE" and the attachment name starts with "Facture", it creates a file in the "/Documents/factures ANP/laayoune" folder.

 

So my request is to change attachment name into the numbers in the email body that follows the sentence XXX

 

each time i try i get error : Le ou les paramètres d'entrée de l'opération « for_each » contiennent une ou plusieurs expressions non valides. Corrigez la ou les expressions non valides pour le ou les paramètres d'entrée de l'opération « for_each ».

 

 

in create file : file name : @substring(triggerOutputs?['body']?['body'],add(indexOf(triggerOutputs?['body']?['body'],'Facture numero :'),16),8)

Categories:
  • SudeepGhatakNZ Profile Picture
    14,396 Most Valuable Professional on at

    Why do you have [body] twice?

    triggerOutputs?['body']?['body']

     

  • asmahri Profile Picture
    32 on at

    First  substring second indexof. Can you tell me what's wrong i'm no good in this 

  • SamLed Profile Picture
    2,340 Moderator on at

    Hi @SudeepGhatakNZ,

     

    I first wondered same, but I've checked, it is the mail body property of trigger output body object 😉

     

    Regards,

    Sam 

  • SamLed Profile Picture
    2,340 Moderator on at

    Hi @asmahri,

     

    Sorry, I'm not sure you're design is the best way to achieve what you want to do, can you post screens of your flow ?

  • asmahri Profile Picture
    32 on at

    The flow is working fine . Saving attachement into folder following instructions but when i add rename attchmnt it give me error in for each. Gave me a headache

  • SamLed Profile Picture
    2,340 Moderator on at

    Yes, I understood but you're giving us an expression outside its context and just telling it failed, that's not enough, we need to see the error, input data and how you design the failing part otherwise it will be difficult for us to help you. 

  • asmahri Profile Picture
    32 on at

    Appreciate your help dear. I'll be on my computer in few minutes take screenshots 

  • asmahri Profile Picture
    32 on at

    1.png

  • asmahri Profile Picture
    32 on at

    here are step by step

    2.png3.png4.png

  • SamLed Profile Picture
    2,340 Moderator on at

    Ok, est-ce que le corps du mail contient toujours "Numero facture :" ? J'entends exactement sous cette forme (casse, accentuation, etc...).

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 302 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 263

#3
Henil Profile Picture

Henil 115

Last 30 days Overall leaderboard