jamiesu
0
Q:

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);
      })
    })
  }
0

New to Communities?

Join the community