Hi All,
I am a total Newbie with PA, so I hope someone can be so kind and give me a hand.
I have employees fill out a form (Contact Form 7) and attach files to it. The resulting email with attachments lands in my Outlook365 mailbox.
I have the "Save Office 365 email attachments to OneDrive for Business" flow working nicely. What I really need is to have the attachments renamed automatically with text from the email. Specifically what document the attachment is and their employee ID number.
For example, employee 12345 fills out the form and attaches a picture of their ID card. I need the file attachment in Onedrive to be named 12345_ID Card.
Thanks so much for reading my problem, and I hope someone can help me out.
Have a great day
Hi @paddy76,
You could use the split() function to extract the Employee ID, the split function could convert a string into an array, you could use the special word as a separator to stripping out employee ID, the first split function use "Employee " (here is a blank space), the second split function use " just":
first(split(last(split(triggerOutputs()?['body/subject'],'Employee ')),' just'))
After get the ID, you could use it to rename the file.
Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Lin Tu,
thanks so much for the response. Much appreciated.
Actually, would that solution pull the data from the email? The employee number would change all the time based on who filled the form, so the employee number would not always be 12345. The employee number would be in the subject of the email. PA flow should extract that number and use it to rename the file in Onedrive.
----
From: Form@submittedonmywebsite
Subject: Employee 54321 just submitted a form
Attached jpeg
----
In Onedrive the jpeg is renamed 54321.jpeg
Thanks so much for your help 🙂
Paddy
Hi @paddy76,
You could use concat() function to combine the Employ name and ID card number:
concat('<text1>', '<text2>', ...)
Here is an example, after create file in OneDrive folder, rename the file, but should combine the "12345" and "_" with original file name and then add at the end of the folder.
concat(outputs('Compose_2'),'_',outputs('Create_file')?['body/Name'])
Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.