0

I have a list and above this library is a picture button. When I click on this button I would like to call the function which is on "new item". It should appear the form where I can upload the document with the properties

How can I trigger that?

  • Hey can you rephrase the question or add some pictures? – Naveen Jun 16 '15 at 12:07
  • Normally in a library you can click on "new item" and then a small dialog lauches where you can upload your document. Then you need to set the document meta data (properties) I need this function on a picture. If you click on that picute/button then the same dialog should appear – user24555 Jun 16 '15 at 14:38
  • Were you referring to "Upload Document" button on ribbon? – Naveen Jun 16 '15 at 15:54
2

Step 1: Click on the "Upload Document", you will get a popup

Step 2: If it is IE browser right click on popup and click on Properties and copy the full Address (URL).

Step 3: Assign the above URL to options.url in the following code

Step 4: Attach the click event to your custom button using jQuery or Javascript like below

$('#btnUpl').click(function(){

var options = SP.UI.$create_DialogOptions();

options.title = "My Dialog Title";
options.url = "http://YourURL/_layouts/15/Upload.aspx?List=%7B3021DE8C%2DE1E1%2D4ACC%2D9FF7%2D3F355B5038C3%7D&RootFolder=%2FDocuments&Source=http%3A%2F%2Fentd2spweb02%3A1984%2FDocuments%2FForms%2FAllItems%2Easpx&IsDlg=1";

SP.UI.ModalDialog.showModalDialog(options);

});

Let me know if you have any questions.

  • Where I get this item '#btnUpl'? – user24555 Jun 17 '15 at 20:04
  • That is your button ID, you are attaching a click event to your button using jQuery with the above code snippet. If you cannot use jQuery use pure javascript. I hope you understand the base idea behind it. I tested it and it worked for me. – Naveen Jun 18 '15 at 6:48
  • thank you! I get the idea, but can I use only the script editor for performing this? – user24555 Jun 18 '15 at 7:31

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.