I have created the following flow:
Save my email attachments to a SharePoint document library.
The flow has no errors or warnings. This is the problem :-
Whenever I get an email, the flow does not save the attachment into SharePoint. Now, if I go to the flow, edit and just re-save it without any changes, on re-saving it runs and saves that attachment into SharePoint.
When I send a second email, again, the flow doesn't run. I have waited for ~30 minutes and still it does not. However, as soon as I resave the flow, it runs at that instant.
My flow is correct but why am I experiencing this issue? I am confused regarding the problem causing this.
I created a similar flow where the email attachment saves into my OneDrive, in this case, the flow runs smoothly all the time, without any troubles.
Any help will be appreciated.
Thank you!
Hey Man, I ran into a BIG problem.
The flow successfully works. However, here is the issue ->
If I email myself, the csv file gets renamed, timestamp gets added and it saves successfully without messing the file.
If my colleague sends me an email with the same file, renaming and timestamp works but as soon as I open the save file, the entire file gets messed up. All data is lost and there's a bunch of gibberish.
Why is this happening? How do I fix it?
Hi Ellis,
Thanks for the help. I ended up figuring out another way to do it.
I used the current time built-in function, pulled out its output, saved it in a custom format "yyyyMMdd-HHss". Once this was done, I added this output with new file name as "yyyyMMdd-HHss-Input_File.csv".
It worked.
Appreciate all the help. Still new to this and its super fun.
Can you post a screenshot of the error?
When entering the expression in the Expressions editor, you will need to enter it similar to this:
formatDateTime(body('Current_time'), 'yyyy-MM-dd-HHMMss')
The above is the preferred method if possible.
Or directly in to a string value, only if the variable names in the demo match your variable names, e.g:
The expression below can be copied and pasted into a variable.
@{formatDateTime(body('Current_time'), 'yyyy-MM-dd-HHMMss')}
Ellis
Hey man,
I am trying to do so but the expression you provided, it keeps getting flagged as invalid on my end.
Do you know why?
Here is one method you could use to achieve this. Get the current time, format the current time so it can used as a be pre-fix for the filename:
The expression below can be copied and pasted into the variable TimeStamp:
@{formatDateTime(body('Current_time'), 'yyyy-MM-dd-HHMMss')}
The timestamp format uses year, month, day, hour, minutes and seconds:
Hope this helps.
Ellis
Hi Ellis,
Hmmm, makes sense. But let me give you some more context.
The purpose of this flow is to put a email attachments (these attachments will be of same format, being sent to one particular distribution list) in sharpoint so my python script can access this file.
My python script reads "Input_File.csv", hence I do renaming under automate flow. The issue is when a second attachment is sent, it overwrites. To not allow this, I was thinking of adding a timestamp to differentiate the files.
Thoughts?
I would advise leaving the filename untouched (unless you want to give the file a more meaningful name) and use what SharePoint already knows about the file (the meta data). We can display a column showing when the file was created in the SharePoint list or library. Without any real "work" you can display the file's Created time (or Modified time, or Created by person, or Modified by person) on your view:
You can also change the order the files (items) are displayed: newest first, oldest first, or sort alphabetically. This can be done by changing the current view or creating a new view to display your content.
To learn more about SharePoint views please see: Create, change, or delete a view of a list or library
Ellis
I did what you asked for by making a copy.
The flow somehow is running faster now. I did two trial runs and it took 3-4 minutes max to get the file to sharepoint. What is happening? I am confused on the backend workflow behind these automate flows.
I have a follow-up question which is bothering me. I want to add timestamp to my file name so it is easier to see on sharepoint which file was received when.
This is how I am renaming the coming attachments to "Input_File.csv". I want to rename it to "Input_File_(timestamp).csv"
Any insight would be great.
Can you share the flow and the run history (see below):
in step 3 click on the one of the run time dates:
This will show the execution of the flow. We may be able to look inside some of the actions to see what is going on.
Click on the actions that have executed view input to and outputs of the actions:
Ellis
Thank you, I will go ahead and give this a shot.
In the meanwhile, I did some digging and testing. My current flow works perfectly but it is taking ~1 hour for every run. It takes ~1 hour for files to get saved into my Sharepoint library but continues to be instant for OneDrive.
Could this delay be because I use VPN to connect to my company's server? I work remote right now. Or it is something which can't be fixed?
Thanks!
WarrenBelz
146,601
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,942
Most Valuable Professional