cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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..

 

Screenshot.png

 

 

Here is the error log.

Screenshot (1).png

 

 

 

 

7 REPLIES 7
Highlighted
Memorable Member
Memorable Member

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!


Highlighted
New Member

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

Highlighted
Continued Contributor
Continued Contributor

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.

Highlighted
Dual Super User III
Dual Super User III

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!



Highlighted
Memorable Member
Memorable Member

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!


Highlighted
Advocate III
Advocate III

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
Regular Visitor

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (7,291)