#StackBounty: #sharepoint-online #calculated-column #pages #copylink Button on SPO Page that copies the URL of an item in a list view w…

Bounty: 50

Basically, if ONE document in a document library LVWP is checked, a button should become active. When clicked, the button will copy that document’s absolute encoded URL to the clipboard. It doesn’t have to be pretty or slick, it just has to work. I don’t know how to use powershell and would prefer a solution that could be dropped in the Page’s script editor WP.

If there are no items checked or more than one items checked, the button (when clicked) should prompt an alert box saying something like "Make sure only 1 item is checked"

I cannot create a calculated column because I’ve exceeded my list view threshold. If this wasn’t the case, I’d create a calculated column using:

CALUCLATED COLUMN

="<div class='input-group mb-3'>"&"<input type='text' class='form-control text-copyurl'
value='"&urlText&"' id='urlToCopy'>"&"<div class='input-group-append'>"&
"<button class='btn btn-light btn-sm btn-copyurl' onclick='myCopyUrlFunction()'>"&
"<i class='fa fa-clone' aria-pressed='true'></i>"&" "&"Copy"&"</button>
        </div>
        </div>"

SCRIPT REFERENCE

 function myCopyUrlFunction() {
      var copyText = document.getElementById("urlToCopy");
      copyText.select();
      copyText.setSelectionRange(0, 99999)
      document.execCommand("copy");
      alert("Copied the text: " + copyText.value);
    }

Thanks in advance!


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.