i am trying to update a file properties that i have just uploaded. Once the file has been added to the library,i am doing another http request to get the file properties but it is not working.i can't seem to get any fields return. Here my code :

let web:Web=new Web(_context.pageContext.web.absoluteUrl);  
    var listItem=web.lists.getById(_listName).rootFolder.files.getByName(file.name).listItemAllFields

I am using this spfx sample: link

The code for the upload of files can be found here: https://github.com/SharePoint/sp-dev-fx-webparts/blob/master/samples/react-file-upload/src/webparts/fileUpload/components/FileUpload.tsx

Code for upload using dropzone component:

 processing: function (file, xhr) {

      myDropzone.options.url = `${_context.pageContext.web.absoluteUrl}/_api/web/Lists/getById('${_parent.props.listName}')/rootfolder/files/add(overwrite=true,url='${file.name}')`;          


        alert('Item not found or query string value is null!')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.