web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to delete a file i...
Power Automate
Answered

How to delete a file in one-drive (business)

(0) ShareShare
ReportReport
Posted on by

When i try to delete the file by selecting the file from the folder it works fine

Sami3_0-1717567873893.png

 

 

but when i try to use a variable(with a path in it) it doesnot work and throws an error

Sami3_1-1717567984558.png

Sami3_0-1717569017908.png

 

 

 

i want to make it dynamic,thanks

I have the same question (0)
  • Verified answer
    Deenuji_Loganathan_ Profile Picture
    6,255 Moderator on at

    @Sami3 

     

    Please follow the below approach:

    Deenuji_0-1717569645031.png

     

    Deenuji_1-1717569694910.png

     

     


    Thanks,
    Deenuji Loganathan 👩‍💻
    Automation Evangelist 🤖
    Follow me on LinkedIn 👥

    -------------------------------------------------------------------------------------------------------------
    If I've helped solve your query, kindly mark my response as the solution ✔ and give it a thumbs up!👍 Your feedback supports future seekers 🚀

     

     

  • eetuRobo Profile Picture
    4,556 Super User 2026 Season 1 on at

    I think that connector requires actually the file Id. Its bit confusing since when you pick the file manually it just shows the file path.

    So you want to first use "List files in folder" OneDrive action. Then that lists the files and folders.
    It has .Id property in the List of Connector objects

    eetuRobo_0-1717569890856.png

    You need to use that in your variable that you use in the Delete file action "File name" field.

    eetuRobo_1-1717569969504.png

     

    So you need to build bit of extra logic so you select the correct file id.
    Something like this:

    eetuRobo_2-1717570560950.png

    List files in folder lists all files in the selected folder.
    For each loops those files
    If checks if current loops file name is same as %FileName% -variable (test.txt)
       If it is then it sets loops file id to %FileId% -variable
    Delete file action uses %FileId% -variable.

  • Deenuji_Loganathan_ Profile Picture
    6,255 Moderator on at

    @eetuRobo 

     

    This is how most Microsoft cloud packages work in PAD. You can't achieve everything in a straightforward manner as per their documentation, and it always requires some workaround to make it work 🙂

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 474

#2
11manish Profile Picture

11manish 268

#3
David_MA Profile Picture

David_MA 243 Super User 2026 Season 1

Last 30 days Overall leaderboard