cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
KCC
Level: Powered On

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

 

Screenshot.png

 

 

Here is the error log.

Screenshot (1).png

 

 

 

 

7 REPLIES 7
Super User
Super User

Re: delete file in sharepoint document library created in same flow

Hi @KCC

 

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

 


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

Gustavo Moraes, o astronauta brasileiro do Flow!


AndreaBergese
Level: Power Up

Re: delete file in sharepoint document library created in same 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

Italy

tianaranjo
Level 8

Re: delete file in sharepoint document library created in same flow

@gamoraes

 

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

Thanks.

Dual Super User
Dual Super User

Re: delete file in sharepoint document library created in same flow

@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'))

 



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

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


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Super User
Super User

Re: delete file in sharepoint document library created in same flow

Yes @efialttes


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

Gustavo Moraes, o astronauta brasileiro do Flow!


panterra
Level 8

Re: delete file in sharepoint document library created in same flow

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

Highlighted
KCC
Level: Powered On

Re: delete file in sharepoint document library created in same flow

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*

 

Helpful resources

Announcements
firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors
Users online (4,887)