I have a Text field called urlText in a Document Library List. Everytime a document is created, a workflow populates this field with the URL of the Document. I want to make a calculated column/button that appears next to eachf item in a list that, when pushed, copies that document's URL to the clipboard. Is this possible to do?

  • This should be doable with some JavaScript. – Cornelius J. van Dyk Apr 26 '17 at 1:56
  • Why a calculated column? Easiest way is to apply CSR with a JSLink and add a button to the title field that does: sitepoint.com/javascript-copy-to-clipboard You can stuff that in a Calculated Column, but a pain to develop/debug But why an extra urlText field? That info is available as HREF on the Title column – Danny '365CSI' Engelman Apr 26 '17 at 7:25
  • I want a button for each corresponding list item -- it seems like it would be easier as a calculated column. – TheJDScott Apr 27 '17 at 16:10

Here's some JavaScript from another question on Stack that copies one field. The question is asking how to copy multiple fields, but you can get what you want from the questions code. Copying all the field's value of a list to other list using javascript

Once you've got the value from the list fields, you can copy it to the clipboard like this Stack thread recommends. https://stackoverflow.com/questions/400212/how-do-i-copy-to-the-clipboard-in-javascript

  • That answer copies field values to other items/lists, does not have any copy-to-clipboard code – Danny '365CSI' Engelman Apr 26 '17 at 7:23
  • Danny, using the resource you'd sent before, how would I point the js to identify a sharepoint column named "DocId" (internal name) and place the copy button next to it? – TheJDScott Dec 17 '18 at 16:51

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.