Broken Links and Images in SharePoint Emails – A Nintex Fix Up
If you are experiencing broken images (URL’s) and links in notification emails coming from SharePoint, it may be due to a discrepency between how image and link assets are referenced in the blog posts (using only a /relative URL instead of a http://FQDN/ -based URL).
What
images and links will be broken because their URL’s are missing the servername.
For example;
Image is trying to go to: http://blogs/Lists/Posts/Attachments/777/myimage.png
instead of https://go.mysharepoint.com/blogs/Lists/Posts/Attachments/777/myimage.png
..and so displays as a nasty red X (or nothing at all) in your users email client.
So What
So, Nintex to the rescue:
In the workflow that emails our staff notifications of the new blog post (including the blog post content), we do some string replacements on the body of the email:
1. Create a new Muliline Text variable called vOutputText
2. Create a new Regular Expression Action in your Nintex workflow:Pattern (ignore case): src=”/blogs/Lists/
Operation: Replace Text
Replacement Text: src=”http://go.mysharepoint.com/blogs/Lists/
Store Result In: vOutputText
3. Rinse and repeat step two for each variation of links you encounter in your posts. You may find that authors consistently use other SharePoint Document Library, List and Site link patterns in their posts. You should add a new regex for each one of those.
4. Set the vOutputText to be the content of your notification email action.
5. Fire up the workflow and the email containing your blog post content should display the rebased URLs you addressed as expected.
Now What
That being said – as mentioned this is a basic & brittle approach – chances are other link patterns will sneak in there and you’ll still get broken links when people reference new parts of your SharePont site that you didn’t account for. If you care to go deeper into Regular Expressions, the Nintex Regular Expression action is fully capable of supporting more advanced expressions that would be able to rebase URL’s that are missing their root domain name and not get tripped up on differences in subfolder paths. Since this is a Nintex Action lesson and not a Regular Expression lesson, I will refer you MSDN for learning more about Regular Expressions and to the great program RegexBuddy for developing and testing your fabulous new bullet-proof Regex’s.
Noble
Hello Keith,
Thanks for posting the blog – it’s great help. I tested it’s work with HTTP – BUT NOT with HTTPS. But I am still not seeing the Red X for HTTPS.. Any thoughts?
thanks
Noble
Keith Tuomi
The one we use in production now replaces the following string:
=”/
with:
=”https://go.itgroove.ca/
You would of course change the base URL to your own portal. Note that this would force the destination to https.
Noble
Hello Keith,
Thanks for replying back. I am applying the solution for SharePoint 2013 Announcements. I insert images in the Body of the Announcements. And I am getting Red X in outlook 2013. Any thoughts?
Thanks
Noble
Keith Tuomi
Let’s try and figure out what went wrong. Go to the output in Outlook and view the source:
1. Double click on the mail, this will open it in a new window.
2. After that, then click on File > Properties. You will be able to see the header information from there.
3. For the “view source”, right clicking on mails that have a source will by default open it in notepad.
Look for the broken image in the HTML source of the message. You should quickly be able to spot how it’s URL may be malformed – either it’s going to be missing the root relative URL (e.g. http://www.mysite.com) or something is broken in the querystring.
It should also be noted that this overall regular expression we are using is specifically wired to redirect to the path /blogs/Lists/. If your using an Announcements list it will likely be posting to a different URL- just check the URL of an existing Announcement image by right-clicking it and viewing it’s properties. If people are going to be posting to a variety of different paths then you will need to dream up a more advanced Regular Expression. I highly recommend Regex Buddy for developing Regular Expressions.
Noble
Hello Keith,
Hope you are doing great. Do you know how I can use your solution with Bamboo Workflow Conductor?
Appreciate the assistance
thanks
Noble
Keith Tuomi
Hi, I have not personally used Workflow Conductor but after a quick peek at the documentation at http://store.bamboosolutions.com/OnlineDoc/default.aspx#AppID=1649 I don’t think there is equivalent functionality to Nintex to be able to run Regular Expressions against variables. You could always check with Bamboo’s support to be sure though.
Dan Gorman
Hi,
I am trying to apply this solution as I have the same issue – my email notifications show a broken link when sent from the workflow.
However, when I create the Reg Ex action in the Nintex workflow it requires that the Input Text field is completed…?
I am also a little unsure how I use the new variable to format the notification mail? How do you reference the variable into the HTML or the picture link function?