Hi there, am trying to build an automated Approval triggered from a SharePoint list which contains attachments. I'm struggling trying get the links to the attachments included with the approval. I have searched and see there's an upcoming release (or workaround) for attaching the actual attachments, however I am just trying to link directly to them.
Have tried a string and getting the DisplayName and AbsoluteUri dynamic content, but they come through as text. Using the markdown formatting of [Link Text]() in the string variable doesn't seem to help.
Even if I just have the AbsoluteUri in the string variable, it comes through the approval as text (not a clickable link).
Send email using the variable works (as does sending email with option), but not the approval workflow.
Please help, I didn't think this would be so hard?
Solved! Go to Solution.
Are you trying to link directly to a file attached to a SharePoint list item?
This post may be of interest: https://powerusers.microsoft.com/t5/Building-Flows/How-can-i-add-a-hyperlink-in-the-Approval-email-L...
Hey @Jay-Encodian, I can do it via in Power Automate into an email, but not in an Approval....
The thread you linked to shows you can do what I'm doing but in an email with options, not an approval.
Ok, I just did some testing on this... this doesn't work:
It will generate something like:
The issue is caused because the URL is not encoded... this will work:
The expression is: encodeUriComponent(item()?['AbsoluteUri'])
Thanks @Jay-Encodian - do you get clickable links? It doesn't work for me:
The test link to google works fine. But the ones to the sharepoint items do not work.
No I can't... I've tried about 30 different way so far and I can't seem to stop the dynamic variable being written into the email as a single ordered list item in the email HTML... which is what is breaking the links.
Tables, line breaks and all the documented methods don't seem to work... I'll take a look in the morning
Sigh, so doing some more testing and Outlook (desktop) breaks this functionality, where Outlook Web seems to work?
It might be a specific scenario (of file name?) but I'm pulling my hair out with this.
Web outlook does this:
While Outlook 2016 does this:
I'm guessing its because there's '(' ')' in the filename? Have you any other suggestions?
I've been testing by the client ... i did wonder why only partially encoding the URL worked as opposed to the full URL.
If you have the email as a HTML file you'll be able to see the issue... the full content of the variable is written is a single list item <ul>.
I have an idea... albeit it might not be very elegant!... back shortly
Some progress... albeit there is a slight issue I need to try and fix:
The if expression: if(empty(string(variables('Links'))),null,string(variables('Links')))
The idea... (albeit not elegant), is to add each string to the details section independently, which works, however it would require you to have a consistent number of attachments.
To mitigate this; the if expression should check for a null value and only add a value if on exists... whilst the if statement works, Flow still blocks the reference to the array item when it doesn't exist... which is annoying as the expression handles it.
I'll try to fix later today
Thanks @Jay-Encodian - the number of attachments is not a constant - sometimes there might not be any at all. It might be easier to enfoce removing ( )'s from the file names than figuiring out a work around?
Would it be any different using a HTML Table?
The issue isn't just the URL's... even when they are correct they are not clickable as writing in multiple files from a single variable adds them as a single ordered list item in the HTML.... so even if they look correct they aren't clickable.
The last post solved that and the if expression should have taken care of not knowing how many files there were but Flow is enforcing a null reference check to a non-existent array item even though its handled.
Sorry, been v busy today... will look again tomorrow.
A HTML table is worth a go