We have Microsoft CRM Portal/Power Apps Portal and Document Location is exposed to end users. Users can upload files from Portal to SharePoint folder of the record and delete the files. We have to set a flag to show if one or more file(s) are uploaded or not. We have one flow that runs when SharePoint item is created. We get all the metadata and then update the flag in CRM for that record.
When the file is deleted from the portal, we just get the file name. The file does not go to the recycle bin even as Portal use Sharepoint REST API and these files do not go to the recycle bin. I am not a SharePoint expert but when I delete the file from the Sharepoint interface the file goes to the recycle bin and from there, I get the metadata.
Is there any way to get the metadata of the file to know which folder it was deleted OR enable recycle bin for the file deleted via REST API?
In fact, with REST API if you use
deleteObject()
the file will be deleted without going to the recycle bin. It's by design. But, if you want to send the file to the recycle bin, you have to use therecycle()
endpoint!Sample of REST request:
Documentation: SP.ListItem.recycle Method