Hi,
I made a flow that will send email of stored attachments in SharePoint list as email when a value in SharePoint list is modified.
what is happening now that i will get all stored attachment in SharePoint.
my goal is to get only the latest added attachment when the value in SharePoint list is modified.
my flow is running like bellow:
what I can modify in this flow that will help me to get only the latest added attachment in the list.
i have tried also to use last(outputs('Get_attachments')?['body'])?['Id'] as ID in get attachment content
thank you
Hi Rhia,
Could you show your observations in the flow?, it is not so clear to me,
thanks
I think the first paragraph solution should work. As currently her array is taking everything from her data source. But getting the path of the last modified document by date yyyyMMddhhmmss should at least get you the data you want to retrieve
Hmm, it seems like (tested on my side) attachments come back to us in alpha-order by name, and their ID is only an encoded path.
So I think what you'd need to do, rather than use "Last" (as that will always just get the furthest down the alphabet line), is - use "Get File Metadata Using Path" and point it at the "AbsoluteUri" output from your "Get Attachments" action. From here, you can see the "LastModified" date - so if you collect the filename and the LastModified into an array, then you should be able to figure out which is the most recent, and only send that one.
Or, if that's a bit much, you could make another column and just add the filename of the attachments that have been sent. Ie, Bird.PNG is added, gets sent - add Bird.PNG; to a multi-line of text column against that item. Someone adds Cat.PNG - flow runs, checks if the attachment added is present in the MLT, if not, sends attachment, adds Cat.PNG to the MLT.
Cheers,
Rhia