Dear all,
Firstly, I would like to say hi to all of you.
Currently the scenario in my company: when an email with xml attachment send to an outlook mailbox. It will get this attachment and save to my sharepoint folder. I have created the flow as images below and works well.
But we have problem that if someone suddenly send the same file after a while then the file in my sharepoint will be overwrite. Therefore, my concern is that: how can we create a flow that after the attachment email arrive, it will check if the file is already exist then it will create another file name with date suffix in my sharepoint (example: a.xml, a-date.xml)?
Because I'm so new with this technology and my programming skill is not good enough so I seek for your help for our solution. Thank you for your reading my post and I will look forward to hear from you.
Stay safe and healthy all.
Solved! Go to Solution.
See my screen shots below. Note that in the Create file action that is used when the file already exists, I am prepending the filename with the current date and time - you can substitute whatever you want there. Also, I didn't take the file name without the extension and add something to the end and then add the file extension back. I didn't do that because I didn't want to complicate the solution. To do so, I would need to use a split() action to break the file name apart. If you need that, just let me know and I'll add it in.
Before creating the file, use a Get files (properties only) action. Use an OData filter query in the action to find only files with a certain name. If it returns any files, you know that the file already exists and you need to change the name of the file that you are attempting to create.
Let me know if you need an example.
Dear @ScottShearer
Thank you for your reply. Can I have your example? It would be a lot of help for me.
See my screen shots below. Note that in the Create file action that is used when the file already exists, I am prepending the filename with the current date and time - you can substitute whatever you want there. Also, I didn't take the file name without the extension and add something to the end and then add the file extension back. I didn't do that because I didn't want to complicate the solution. To do so, I would need to use a split() action to break the file name apart. If you need that, just let me know and I'll add it in.
Dear @ScottShearer
Thank you for your wonderful magic. I have applied your practice and worked well.
But I have 2 problem and still need your help.
1/ The time of date in this image
How can we convert the time to our regional? We are in GMT+7 - Hanoi time.
2/ How can we remove the email signature just get the specific attachment file? Our finance team just only want to get the XML attachment file from user.
You can use a Convert time zone action to convert UTC to your local time. Refer to the output of this action rather than utcNow() when naming the file. Select the date format of your preference.
To limit what you do only to XML files, add another condition and put your existing condition inside of it (on the true side). See my example below. I am converting the file name t lower case and testing if it ends with xml. If it does, then I go onto the second condition where you actually create the files in SharePoint.
Dear @ScottShearer
I have followed your example for remove signature but my sharepoint is not create the xml file even the flow test successfully
Where did I go wrong? Thank you.
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!
User | Count |
---|---|
15 | |
14 | |
7 | |
6 | |
5 |
User | Count |
---|---|
24 | |
18 | |
10 | |
8 | |
6 |