Building a Hyperlink in an Email with SharePoint Designer
Guest Author: Jim Bob Howard
For folks very new to SharePoint—and possibly HTML, I wanted to share a quick tip sending a link to a SharePoint item via email.
I’ll assume you either know how (or can look up on EndUserSharePoint.com) how to launch SharePoint Designer (SPD) and create a workflow. So, let’s start with adding the Send an Email action:
- Choose Send an Email from the Actions menu
- Click on "this message"
- In the body of the message, we want to add a link where the ‘[ ]‘ is located
- Replace the ‘[ ]‘ with ‘<a href=""></a>’ (without the single quotes)
- Point your browser to an item in your list (we’re going to copy and paste the URL here)
- Highlight the URL in your browser
- Press Ctrl-C to copy the URL
- Toggle back to SPD and paste (Ctrl-V) the URL between the double quotes
- Highlight the ‘1′ at the end of the text you just pasted in
- Click Add Lookup to Body
- In the Field dropdown, choose ID, and click OK
- The next step is to put text inside the anchor tag (<a href="…"></a>). That’s what will be clickable in the email. I suggest using the Title field.
- Place your cursor just to the left of </a> and click Add Lookup to Body again
- This time, choose Title in the Field dropdown.
- Click OK
- Add any other steps and actions you choose to the workflow and click Finish

Click ‘this message’ to configure the email

Screen clipping taken: 12/15/2009, 1:52 PM

Highlight the URL in your browser

In your case, ’site,’ ’subsite,’ and ‘listname’ will be replaced by an address specific to your site.

The ‘1′ at the end of the URL was highlighted before clicking Add Lookup to Body

Add text for the user to click on
Now, whenever a new item is created, the person who created it will receive a link to that specific item via email.
If you would prefer that they are taken to the item page in edit mode, simply replace DispForm.aspx with EditForm.aspx in the text you pasted in Step 7.

Jim Bob Howard
Jim Bob Howard is a web designer / web master in the healthcare industry. He has been working with SharePoint only since March 2009 and enjoys sharing what he has learned. You can email him at [email protected].
Wow, simple HTML like we learned it 15 years ago! ;-)
True. But “we” didn’t all learn it 15 years ago. ;)
I agree with you! :-) And godd for those, who didn´t know how it works! Thanks!
This does not work if the URL has spaces in it. For example if I’m embedding the user name(FirstName Last Name) dynamically then it comes as FirstNameLast Name in the URL, there is no space between the FirstName Last Name.
Sanjay,
I’m not quite sure what you mean by “embedding” the user name.
If you are passing it as a querystring, and pulling the First Name and Last Name from your list item, then you can add a space by simply inserting “%20″ between the two fields when you build the URL.
If that’s not what you mean, comment again and I’ll try to answer your specific dilemma.
Blessings,
Jim Bob
Hi Jim,
Thanks for responding.. I cannot user “%20″ because my query strings comes dynamically(i.e. workflow variables). I will explain here to make this more clear:
I will have the hyperlink in my SPD workflow email body as follows but query string values will come dynamically
click here
When user gets this in email, the link comes as follows:
https://outlook.servername/owa/redir.aspx?C=da8c5df0fcc746f98145fffc467d0701&URL=https%3a%2f%2fservername%2ftest.aspx%3fQS1%3dtest%0user1%26QS2%3dtest+user2
If you observe here in above link, th first space between test and user1 has been converted into “%0d%0″
Now when user click on this, the browser converts this to
https://servername/test.aspx?QS1=testuser1&QS2=test+user2
So it removed the space between test and user1 for QS1 but QS2 works fine.
Sanjay,
Where are the workflow variables coming from? Are you sure you’re not getting ‘%0d%0a’? That would be a carriage return/line feed. If it’s coming a column, we might be able to strip those out and replace them with a true space, or %20.
Blessings,
Jim Bob
Its a workflow variable set to user name using a custom workflow action..
As this problem comes only for 1st query string variable. I did a workaround by making first query string variable as a dummy variable with space thenmy real query strings ..it worked fine.
I think its a SPD workflow bug ..I saw some more query related to this in MSDN discussion fourms as well.
Thanks for your help Jim ..
Hi,
I have added a link in the email content, to open a word document, when the user gets the mail. When the user clicks on the link, the user gets the username and password prompt. I want to disable user prompt while opening document.
How to achieve this?
Thank you
Dear Venkatesh,
I’m assuming this is a system-specific issue to your organization and/or the document they’re trying to open. If they’re not logged in to SharePoint (assuming the doc resides in a Document Library on SP), they may get that login prompt. Or, if there is some security system set up that prompts more regularly, that may be the culprit as well.
Hope that helps (and sorry I couldn’t help more).
Blessings,
Jim Bob
I am following the directions, but when it comes to step 9, highlight the ‘1′, my URL for the form doesw not have a ‘1′. What should be done?
Thanks,
Brian
What does the URL look like past the last ‘/’ ?
http://d7sharepoint.dot.state.fl.us/departmental/Development/projMan/Project%20Mailing%20Forms
I’m sorry, I should have sent more. My URL does not look like the one in the instructions as far as including the .aspx file. I am not sure how to get to that. I am looking in both the Windows Explorer and SP Designer files trying to get that
The example given here in step 9 is only necessary if you need to feed the item’s ID into the URL. If your URL doesn’t look like this, then feeding it the ID won’t make any sense.
For example, if rather than pointing to a specific detail page for an item, you want to point to the list itself… you don’t need to feed it the ID; just paste it as you find it in the brower location box.
If that still isn’t clear, paste the URL here (without the HTML code around it) and I’ll see if I can point you in the right direction.
Blessings,
Jim Bob
Thank you for your help.I think i am getting it. I was able to send a link in the email that would take me to the Edit Properties page of the form, But i was expecting to get the actual form itself.
The form I setup was a Word document that was created using List Fields in SharePoint. I need the next person down the line to be able to see the form in Word, add info and save back to SP.
I am not sure what you mean here, If that still isn’t clear, paste the URL here (without the HTML code around it) and I’ll see if I can point you in the right direction.
Thanks,
Brian
Then you most likely want to get the filename of the Word Document and supply that instead. In that case, try using the “Encoded Absolute URL” as your entire HREF string, rather than feeding the ID into it…
Does that help?
As for the example, I was asking if you could paste in the URL you are working with, which you are trying to modify and/or include in the email.
Blessings,
Jim Bob
Jim,
Thank you so much for helping.
I tried the Encoded Absolute URL and did get it to work. I have a template in the Document Library. I start the process by creating a new form. I fill in the info that I need to. I save it. Then I do a workflow to send it to the next person to add info. My email in the workflow gives them a link to the document that I created and saved. When they add info and save it is saved back in my SP folder. So far it looks like it is working for me. I am just going to add some more workflows to send notifications and such.
Your site gave me the info needed to get this going.
Thank you,
Brian L Shroyer
One new thing. I am searching right now on your site. I want to be able to select the recipients of my document workflow from my Outlook contacts. So far i have only been able to apply a defualt or maybe type one. I want to be able to pull up a contact list and select as many as needed.
Have you covered this topic? I am searching but if you can direct me to it that would be great.
Thanks,
Brian
Well, I must confess that this isn’t my site. It’s Mark Miller’s. I just one of dozens of authors here.
As for using Outlook for email look-ups in a workflow, I believe Laura Rogers will be the person whose writing you’ll want to look for. Good luck!
Blessings,
Jim Bob
Brian,
Do I have this right?
You want the link to take the user directly to a document in a document library, right? Instead of a view of the list item, right?
If so, try the Encoded Absolute URL and see if that will work for you instead (i.e. <a href=”[%ListName:Encoded Absolute URL %]“>Open document</a>. Another option would be to build the URL as you have, then add a ‘/’ and the [%ListName:File Name %], using the Add Lookup button.
Blessings,
Jim Bob
Excellent. Glad to help, Brian!