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 / delete file in sharepo...
Power Automate
Unanswered

delete file in sharepoint document library created in same flow

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Building a flow that creates a new folder in the Sharepoint Shared Document Library.

 

To do that it seems you need to create a file with a new folder path as a work around since Flow doesn't support creating folders (unbelieveable).

 

While this workaround works, you're left with a useless file.

 

I want to delete that file once it is created. Seems simple right? 

 

I have created this simple flow, which works.

- When new list item is created

- Create File

- Update item with path to new folder

 

When I try to add 'delete file' I use the same syntax to point to the file but I get an error saying the file is not found.even though error log displays the correct path to the file.

 

I assume this is because when the 'delete file' action occurs, the file has not yet been created???

 

If this is the case, how can I wait until the file is created to initiate the 'delete file' action?  I have tried adding as much as a 30 second delay between 'create file' and 'delete file' actions with no luck.

 

This shouldn't be so difficult to simply create a folder, just saying..

 

Screenshot.png

 

 

Here is the error log.

Screenshot (1).png

 

 

 

 

Categories:
I have the same question (0)
  • gamoraes Profile Picture
    1,040 on at

    Hi @Anonymous

     

    The problem are in the 'Delete action' this not transform the string to uri, it is a bug.

    But we have a way to workarround this, follow this steps:

     

    1 - Copy all content that you put in 'File Identifier' field

    2- Open the 'Expression' tab and paste the content in field

     flow.png

    3- remove the '@' and '{' and '}' from the text

       - in my example the first content was:

         /Anotaes do Comercial/@{body('Criar_arquivo')?['Name']}/test.txt 

         after :

         /Anotaes do Comercial/body('Criar_arquivo')?['Name']/test.txt 

     

    4 - put it inside an encodeUriComponent('PUT THE LAST STEP RESULT HERE')

    5 - Save and Done!!!

     

    Hope this helps!

    Best Regards,

     

    Gustavo Moraes

     

  • AndreaBergese Profile Picture
    2 on at

    When this bug will be solved ???

     

    I'm trying Gustavo's suggestions without any positive results !!!

    It seems that now MS Flow (now) put automatically the encodeUriComponent function, but I was unable to save my workflow without errors.

    My File Identifier is "/Documenti SITG/[NAME]" (where [NAME] is the Dynamic Content tag.

    How can I convert it in the right way for the Delete File action ?

     

    Someone could help me ???

     

    Thank you very much.

    Riccardo Germinario

    Italy

  • tianaranjo Profile Picture
    497 on at

    @gamoraes

     

    When you say 'put it inside  encodeUriComponent - where do you do that within the flow?

    Thanks.

  • efialttes Profile Picture
    14,756 on at

    @gamoraes

    I guess in your example you are referring to the following expression, right?

     

    encodeUriComponent(concat('/Anotaes do Comercial/',body('Criar_arquivo')?['Name'],'/test.txt'))

     

  • gamoraes Profile Picture
    1,040 on at

    Yes @efialttes

  • panterra Profile Picture
    207 on at

    Just to confirm with anyone watching this thread from the Microsoft Team, this still seems to be an issue.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    But hey... they just announced more new connections with obscure 3rd party software that hardly anyone likely uses.

     

    Something like being able to create a folder or delete a file required to be created as a work around to creating a folder...

    or how about creating a subsite using a Flow?

     

    Way to address basic use cases MS. 

     

    *smh*

     

  • ITGuyinMD Profile Picture
    37 on at

    When I try this, I get "invalid expression".

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 875

#2
Valantis Profile Picture

Valantis 817

#3
Haque Profile Picture

Haque 481

Last 30 days Overall leaderboard