Emails with attachments getting numbers add to the attachment

Occasional Contributor

My company has reports that get sent out daily. We would like to move those reports from getting sent to various users that need to report and want them to get sent to a teams channel. I set up a channel and did some test and when the report comes out it goes to the channel. I was wondering if there is a way for the attachment in the report not to get this weird strand of numbers listed in the image below but if it could just auto add the date to that attachment instead. This will make tracking the report easier for us under the files tab of the channel. 





19 Replies
best response confirmed by ThereseSolimeno (Microsoft)
Instead of utilizing the email function to Teams, I would setup a Power Automate Flow that has a trigger that monitors an inbox, and a step that posts / uploads the file in it's place. Then you can name the file on the step you use to upload the file from the inbox trigger to the Team and utilize a date expression in the save to sharepoint (team) step..

@Chris Webb Thank you for the reply. That is an option however we are trying to remove mailboxes and email distributions as much as possible. Its something we might test though. Thank you again!

You could have a flow trigger monitor the folder for the channel and rename the file, but it's a bit more difficult as the only way to rename a file in flow with SharePoint is through an http call, which I can find my action and how I do it if you want. So you could have it monitor for files starting with Report Subscriptions_ and rename them to Report Subscriptions_date(etc.)

The only issue I see with this method might be how that file will look in the chat pane in Teams as it might not update, but if all you are concerned with is the file name in the Files tab, this might be a solution to use instead of dealing with inbox flow.

@Richard_Maltese here is the cap of the SharePoint http call action you can use to rename files.

Yeah that is more or so what we are worried about as it posts with the date as a new thread for each email/attachment that comes into the channel. If you can share that with me that would be great.

Again thanks for the help on this!


Youtube search for flow stuff, Laura Rogers Flow should net a ton of content, she does a good job of explaining. Here is a quick mock example of how I would do it, it's just a few steps, when a file in a folder is created, you add your SharePoint URL and folder the channel stores it's files and it will trigger. Then a condition to check if the file name starts with Reporting Schedules_, and if so, then you do an http sharepoint request to rename the file, I tried putting where you would put your document library names in, and at the end, I messed up the screenshot, but you would static in whatever you want the file name then the "formatdatetime(utcnow(),'MM-dd-YYYY') expression would append the date you want, I don't know what you want here, but you would have to mess with expressions to get the name how you want, that example is to just name the file by the current date it runs. 


Hope this helps! 



@Chris Webb I hate to bug you but I think i messed something up here. Below is my flow. However when testing or running it, it wont work i get the second image below. It shows it was successful but doesnt seem to be based off the message on the Yes Condition. 





Your condition is not being met, so the begins with isn't matching or going true to run the HTTP request. Need to click on the trigger action there at the top and see what the filename is returning as for that flow, you might need to adjust that logic.

@Chris Webb Thanks for taking more time to help with this. So I'm checking it but the file name it returns is UmVwb3J0IFN1YnNjcmlwdGlvbnNfMTA5NDY1MjEzNS54bHN4 and the file identifier is showing %252fShared%2bDocuments%252fNEST%2bSubcription%2bReport%252fEmail%2bMessages%252fReport%2bSubscriptions_1094652135.xlsx. Unfortunately I'm not sure what would need to be adjusted. 



If File Name with Extension isn't an option you'll have to put an "Get File Properties" action right under your trigger and pass the identifier to it. Then you should be able to reference the cleaner "File Name with Extension" Value in the condition. You'll also want to use that in the HTTP request etc.

@Chris Webb 

Okay trying what you recommended however it requires and ID under the get file properties so when digging into that one thing I found said to get the metadata file before the get file properties but that then wants map to a specific file in the folder.  Maybe there is something I'm over looking at this step. And every time I add that in I get the last screen shot here. From what i read that means somethings is broken in the process from the trigger to that next step. 






Actually, replace your trigger with "When a file is created (properties only)" you don't need the entire file since you are using an http trigger to rename and you aren't doing anything with the binary bits. That one will supply the proper file name.

@Chris Webb That doesnt let me get past the trigger it give me the enter a sharepoint message i posted above. 

If I run the test it give me the following snip at the top. 



I don't know how you went about replacing the trigger, but it should work fine, you might just create a new flow? That trigger is the one you need to use thou it should be under the sharepoint connector when selecting your trigger.

@Chris Webb
Creating a new one fixed that one message however still looks like its failing. 



I added back in the get file properties under the trigger as well and that still failed. I tried with Name and file name with extension. 




It says Name in the condition, run it and see what Get File Properties is returning for those fields. (filename with extension)

Tried that with the with and with out the get file properties and still go the same result. 


I am wondering why Teams adds the numbers in the first place. It would be great if it added nothing or maybe a timestamp (YYYYMMDDHHMMSS), instead of what looks like a meaningless string of digits.