SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to create a Ribbon Custom Action in SharePoint 2013 that will e-mail links of selected documents in a document library. I can get the Item ID's of selected items, but how can I use these to create a URL to insert into the e-mail body?

My javascript so far:

var items = SP.ListOperation.Selection.getSelectedItems();


Edit: Found a solution below

share|improve this question
up vote 1 down vote accepted

I found a solution to my question. I had to use JavaScript to look in the elements on the page for the href value for each list item.

var items = SP.ListOperation.Selection.getSelectedItems();
var url = "";
var length = items.length;
for (var i=0; i<length; i++)
url = url + "%0D%0A" + document.getElementById(items[i].id).getElementsByTagName("a")[0].href;

I blogged about it here:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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