Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Unanswered

Deleting file in SharePoint

(1) ShareShare
ReportReport
Posted on by 4

Hi,

Have a problem deleting a file previously created in SharePoint with Flow. 

It is a delete file when item created flow; as i am using a tasklist, when a new item is created i used a different flow to create files (actually wanted just the folders but this is a good work-around) and the thing is that i want those files deleted automatically so just the folders remain. The thing is that flow does not seem to find the file. It is the only file in the library. Please prompt me for more details if you think you may have an explanation or a solution.

Thank you.

  • PatrickOToole Profile Picture
    11 on at
    Re: Deleting file in SharePoint

    Hello,

    Not sure if this helps, but I ran into this problem as well. I tried building the URL dymanically too (as I was using dynaically created folders), but it turns out we don't need to!

    -Leave the Site Address as is. My Site URL is blurred out but looks like https://tenantName.SharePoint.com/sites/siteCollectionName

    -Use "ID" as the File Identifyer. Make sure to use the ID field from the newly created document.

     

     

  • remy730 Profile Picture
    3 on at
    Re: Deleting file in SharePoint

    Hello,

     

    Have you found a solution for this?  I too, am having this problem.  I created the delete file step and inserted the site address.  In the File identifier field, I am able to find the file that I want to delete in the search box and it deletes the file but, if I type that same information in the box manually, it doesn't work; with or without inserting dynamic content.  I cannot hard code a file deletion because I will not know the name of the file that is being uploaded.

  • sameli Profile Picture
    2 on at
    Re: Deleting a file in SharePoint where created/modified date is greater than 3 months

    Hi,

     

    Does any one have tried creating a flow to delete a file from SharePoint where in created date/modified date is greated than 3 mos/specified date?

     

    I am trying to look for the trigger for SharePoint to delete a file but not available.

     

    Is there a way or work around to do this?

     

    Thanks.

  • SonOfRainFall Profile Picture
    4 on at
    Re: Deleting file in SharePoint

    Hello,

    Thank you for the reply.

    One file is indeed what i want to delete. THe problem is, that is do not have a fixed adress for the file. I need to use dynamic content in the adress. Like so:flow_delete file.JPG

     

     

     

    The file in question is a .txt file that is created automatically by another flow on the creation of the same item in my tasklist.

    The problem is: it finds the lybrary using dynamic content, (or so the error log explains ) but it cant find the txt in the lybrary.

    I tried using the following file name paramaters: .txt , dynamic values for ID, NameTag, Task Name (the same used for the adress) even all of the above with .txt at the end. Is it that it can;t find the lybrary because of dynamic content or it doesan't recocnise the file name given trough dynamic content, just a specific name?

    If needed i can explain and ilustrate the whole process and folder/lybrary structure i need. Thank you.

  • v-yamao-msft Profile Picture
    on at
    Re: Deleting file in SharePoint

    Hi SonOfRainFall,

     

    If I understand you correctly, you are trying to create a flow to delete a file in SharePoint library when a new item is created in list. Looks like below:

    1.png

     

    But it seems that the action “delete file” only allows us to select a certain file from the library, if you want to delete several files, it might be impossible.


    If I understand you correctly, please consider to create a feature request on Flow Ideas Forum at here:
    https://powerusers.microsoft.com/t5/Flow-Ideas/idb-p/FlowIdeas

     

    If I misunderstand you, please feel free correct me and please provide more details about your scenario for better understanding.

     

    Best regards,
    Mabel Mao

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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard >