So, im building this flow, where i have a mail with several attachments. These attachments needs to be saved in a sharepoint folder structure, based on the attachement's name. The attachment names are the names of our employees. The folder structure is build like this, on the first level we have folders names A,B,C,D.....X. Beneath each of these there are one folder for each employee, where the foldername are the persons full name.
So i want the attachment called "John Doe.pdf" to be saved in this subfolder: "/J/John Doe/". The attachment "Sarah John.pdf" to be saved in this subfolder: /S/Sarah John/". All these folders allready exists.
To accomplish this, i have tried to parse the filename for each attachment in the mail using the Substring() expression. This is where it fails, as i cannot get MSFlow to give me the attachment names as a type string i can work with, the "Attachment Name" is an object.
As seen here, i want to be able to use RegEx's to be able to tell flow, where to put each file, in the folder path.
Anyknow know if this is at all possible ?
Solved! Go to Solution.
Hi @JesperTorp,
I have made a test on my side and please take a try with the following workaround:
/Reporting/substring(...)/split(...)
The substring(...) expression within above formula read as below:
substring(split(item()?['Name'],'.')[0],0,1)
The split(...) expression within above formula read as below:
split(item()?['Name'],'.')[0]
The File Name field set to following formula:
concat(triggerBody()?['DateTimeReceived'],'.',split(item()?['Name'],'.')[1])
The File Content field set to Content dynamic content of the trigger.
Image reference:
The flow works successfully as below:
Best regards,
Kris
Hi @JesperTorp,
I have made a test on my side and please take a try with the following workaround:
/Reporting/substring(...)/split(...)
The substring(...) expression within above formula read as below:
substring(split(item()?['Name'],'.')[0],0,1)
The split(...) expression within above formula read as below:
split(item()?['Name'],'.')[0]
The File Name field set to following formula:
concat(triggerBody()?['DateTimeReceived'],'.',split(item()?['Name'],'.')[1])
The File Content field set to Content dynamic content of the trigger.
Image reference:
The flow works successfully as below:
Best regards,
Kris
Yes, Yes, YES...that was E X A C T L Y what i needed, and it worked like a charm. Thx 🙂
@v-xida-msft ; @JesperTorp - Hi Both - This is really a helpfull post. Thanks to you guys.
I have a similar kind of requirement. We need to save the email attachments coming in our shared mailbox to sharepoint document library based on attachment name.
@v-xida-msft - Can you please help me out with steps. Please have a look at my scenario:
Suppose file name is IN_2019_02_07_Invoice.pdf
Can we achieve this the way you have suggested to @JesperTorp. If yes please suggest expression & steps.
Can we achieve it on run time also, when email come it create the similar folder structure & save document there?
@v-xida-msft; @JesperTorp - All suggestions are open. Please let me know how can i do this.
Thanks in advance !
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Announcing a new way to share your feedback with the Power Automate Team.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
User | Count |
---|---|
72 | |
27 | |
22 | |
15 | |
13 |
User | Count |
---|---|
139 | |
42 | |
42 | |
35 | |
30 |