Search code examples
sharepointautomationsharepoint-onlinepower-automate

How do I delete a SharePoint file in Power Automate without knowing the ID?


I am using Power Automate Cloud with SharePoint Online and I want to delete a file where I know the file name, but I don't know the ID. The file is not the triggered file. Can this be done? I have tried to put the path in the File Identifier and it fails, but the run details looks good to me.

Below is the Power Automate job using SharePoint Delete file option. enter image description here

Below is the Run Error for the job.

enter image description here

The file I want to delete is the exact path by combining Site Address and File Identifier. Is there a different way to do this?

I am able to use dynamic content because the trigger file has the same metadata.


Solution

  • You need to URL Encode the /, replace it with %2F.

    Example:

    %2fDSS Approved%2fexample1.json
    

    Alternatively, you could create a Compose step before hand, to build the path, then use the encodeUriComponent(...) function...

    enter image description here