0

Is there any possibility to create a suite bar link to open an email with the current site url in the body area? At the moment we are using a solution to create suite bar links but it is only possible to insert a "url".

enter image description here

Maybe someone has an idea. Thank you

  • Do you want to return the URL of the site dinamically? – Thales Chemenian Oct 24 '16 at 21:53
1

I think you can achive this by createing a calculated field with the following formula :

="<a href='mailto:"&mail&"?subject=look at this website&body= "&siteURL&"'>"&mail&"</a>"

Note: set the data type as number to show the field as hyperlink

Where the mail is the email field in your list as text , and SiteURL is the field that will updated with the current site URL value via a workflow on item add.

To get site URL , try to create a workflow to update list item with the value of [Workflow Context: Current Site URL]

If you don't need to create a workflow, create a new column that will hold the site url manually and hide it from the default view and set it in calculated field.

Alternative solution:

you can also get the Site URL via javascript and set the value of URL field as the following :

Edit add page > add script editor > add the following code

<script>
function URLwithBody()
{
var mail = document.getElementById("mail_96381d5c-8554-4d7f-9b73-540469240fe9_$TextField").value
var body= "?subject=look at this website&body=" ;
host = window.location.href;
host = host.substring(0, host.lastIndexOf('/')+1);

var finalURL= mail +body + host;
document.getElementById("mailwithbody_8b3ec4fe-5586-4b72-8e32-2343e976a07e_$UrlFieldUrl").value = finalURL;

 }

_spBodyOnLoadFunctionNames.push("URLwithBody");
</script>

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.