After the list item has been created, is there any way to enable the addition of file as a list item attachment without having to open the list form?


Here is what you can do....

  1. Create button somewhere or action which will open a page/popup)...
  2. Create a page/popup where you need to pass item id (where you need attachment to be added)
  3. User FILEAPI to get file dailog box. Use SpServices for upload attachement to list item.

Refererence - http://sympmarc.com/2014/05/27/uploading-attachments-to-sharepoint-lists-using-spservices/

Below will input box to page/popup.

<input type="file" id="attachment-file-name"/>

Use below js code for file upload

/* From Scot Hillier's post:
http://www.shillier.com/archive/2013/03/26/uploading-files-in-sharepoint-2013-using-csom-and-rest.aspx */
var getFileBuffer = function(file) {

  var deferred = $.Deferred();
  var reader = new FileReader();

  reader.onload = function(e) {

  reader.onerror = function(e) {


  return deferred.promise();

getFileBuffer(file).then(function(buffer) {
  var bytes = new Uint8Array(buffer);
  var content = new SP.Base64EncodedByteArray(); //base64 encoding
  for (var b = 0; b < bytes.length; b++) {

    operation: "AddAttachment",
    listName: "Tasks",
    listItemID: taskID,
    fileName: file.name,
    attachment: content.toBase64String()

| improve this answer | |
  • Hi, I've created a page where I've added a file dialog box and a button. I'm guessing when I click on the button, the JS will be fired. Please correct me if I'm wrong. And how do I pass the item id? – Korak Sep 23 '16 at 7:49
  • Hello, you need to add button on the source page from where user selects for which item they want to add attachment for.... from here item id has to be passed it can be in query string.... on your destination page user will user browse button to select file....and then the js will run... – Siddharth Vaghasia Sep 24 '16 at 15:29

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.