1

I have created a button to send an email from a List Web Part on a my Site Page. Using a Calculated Column, I am trying to populate the SUBJECT with the corresponding List Item, and the only thing that appears in the subject line is the first word -- the rest of the value is cut off after the space. I know that if I was only using a text string, I could place '%20' between the spaces. I feel like I have to create a formula to replace all blank spaces with '%20', but I'm stuck. Below is where I've arrived thus far:

"<a href="&"mailto:"&"ithelpdesk@happytohelpyououtguys.com"&
"?Subject="&[Title]&" target="&"_top>"&
"<img src='http://{mysitename}/SiteAssets/ICONS/sent.png'
style='height:20px; width:20px;' /></a>"

edit: I Don't have access to SharePoint Designer right now, so a WF is out of the question

2

If you have not wrapped a attribute string in quotes the browser will cut off at the first space

So add single quotes wrapping the href attribute like you have done for src= and style=

ofcourse problems will occur if the Title itself has a single quote, so this solution is not failsave.

Update #1

="<a href='mailto:ithelpdesk@happytohelpyououtguys.com"
  &"?Subject=" & [Title] & "' target='_top'>"
  &"<img src='http://{mysitename}/SiteAssets/ICONS/sent.png' style='height:20px;width:20px;'/>"
 &"</a>"

If you have single quotes in [Title] you need to wrap in double-quotes:

="<a href=""mailto:ithelpdesk@happytohelpyououtguys.com"
  &"?Subject=" & [Title] & """ target='_top'>"
  &"<img src='http://{mysitename}/SiteAssets/ICONS/sent.png' style='height:20px;width:20px;'/>"
 &"</a>"

since the browser adds quotes around attribute (first) words the shorter version can be:

="<a href=""mailto:ithelpdesk@happytohelpyououtguys.com"
  &"?Subject=" & [Title] & """ target=_top>"
  &"<img src=http://{mysitename}/SiteAssets/ICONS/sent.png style=height:20px;width:20px;/>"
 &"</a>"
  • 1
    Dude, you are so nice! Thank you, as always, for helping me out. – TheJDScott Dec 23 '15 at 14:51
  • Note that instead of one single quote, you can also use two double-quotes in a Formula.. that is the escape notation to get one double quote in the output. – Danny '365CSI' Engelman Dec 23 '15 at 15:08
  • I don't understand...I now have 'Title' as the subject line of my email...is the formula that used above correct? I wrapped [Title] in single quotes. Did that make sense to do? – TheJDScott Dec 23 '15 at 15:13
  • Yes, single quotes is correct. I just added that to get double quotes (also correct in HTML) you need to write two double quotes. i.e. if you have single quotes inside your [Title] you need to wrap it all in double-quotes. (but any double quote inside your [Title] will then break the code)... – Danny '365CSI' Engelman Dec 23 '15 at 15:31
  • Wow. You solved it perfectly -- you are pretty much a genius. Thank you! – TheJDScott Dec 23 '15 at 20:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.