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


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: http://leochensharepoint.blogspot.com/2013/04/using-javascript-with-custom-actions-in.html

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.