Answers for "spfx webpart add file to sharepoint list"

0

spfx webpart add file to sharepoint list

onDrop = (acceptedFiles) => {
    //console.log(acceptedFiles);
    //just one file
    let file=acceptedFiles[0];
    sp.web.lists.getByTitle("TestList").items.add({
      Title: "Upload Attachement"
    }).then(r => {
      // this will add an attachment to the item we just created to push t sharepoint list
      r.item.attachmentFiles.add(file.name, file).then(result => {
        console.log(result);
      })
    })
  }
Posted by: Guest on December-01-2020

Code answers related to "spfx webpart add file to sharepoint list"

Browse Popular Code Answers by Language