Hi there Flow Fans.
A while back I posted in the "Flow Cookbook" with a post called "Save Outlook Attachments And Guard Against Duplicate File Name Overwrite" and here on my blog a post called "Excel Formats Only | Save New Email Attachments to SharePoint". Whilst this How-to blog post works very well, I do mention this:
"Below uses a split to allow us to isolate the file type or extension as well as the file name. It breaks into 2 minus the dot (period). This will work perfectly, assuming there are no dots in the file name itself."
There have been a lot of users in the community contact me saying that these processes work very well for them, although a couple who have mentioned they have "dots" (periods) in their file names hence there can be issues with the flow. This post will address that, so if we consider a file name called "this=is&a.spreadsheet.03.19.xlsx" then we will split this into 2 whilst stripping out any potential problem characters, dots, ampersands, equals signs etc.
So we started with …
File Name: this=is&a.spreadsheet.03.19.xlsx
We will be left with …
File Name: thisisaspreadsheet0319
File Extension: .xlsx
We can then incorporate this process to the Flow I have referenced at the beginning or any other Flow that has issues relating to file names (or any string really) contaning dots, or special characters.
In order to start off this simulated process, I will start with a button. This just means it is easy to test and helps you get the concept of what we are actually doing.
Let's simulate the file name using a "Compose", renamed to "Compose File Name With Dots".
Note: There will be several "Compose" actions used in this Flow, just rename them exactly as you see them and you will be able to copy and paste the code.
Note: You will probably replace this in production by targeting which ever value is relevant. Attachment Name perhaps when working with Outlook Email.