Showing results for 
Search instead for 
Did you mean: 
Regular Visitor

delete file in sharepoint document library created in same flow

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..





Here is the error log.

Screenshot (1).png





Memorable Member
Memorable Member



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


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


Did I answer your question? Mark my post as a solution!

Gustavo Moraes, o astronauta brasileiro do Flow!

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


Continued Contributor
Continued Contributor



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



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


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


Each time you click on any of our inspiring answers 'Thumb up' icon... ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!

Escribo sobre Power Automate en:

Proud to be a Flownaut!

Yes @efialttes

Did I answer your question? Mark my post as a solution!

Gustavo Moraes, o astronauta brasileiro do Flow!

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

Regular Visitor

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. 




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

Helpful resources

MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (1,475)