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
console.log(listItem);
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) {
if(_fileUploadTo=="DocumentLibrary")
myDropzone.options.url = `${_context.pageContext.web.absoluteUrl}/_api/web/Lists/getById('${_parent.props.listName}')/rootfolder/files/add(overwrite=true,url='${file.name}')`;
else
{
alert('Item not found or query string value is null!')
}
},