web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Delete sharepoint file...
Power Automate
Unanswered

Delete sharepoint file - not in JSON format

(0) ShareShare
ReportReport
Posted on by 32

Hi all

 

Hope you can help with this.  I have a long flow which was working file until I added a delete sharepoint file command at the end.

 

The beginning of the flow creates the file

Adam_Lpl_2-1606420754388.png

 

The is then an approval process.  If the approval is rejected I want to delete the file which was made in the earlier step.  I have used the following flow:

 

Adam_Lpl_3-1606420835308.png

 

I get the following error message:

Adam_Lpl_4-1606420886812.png

Please can anyone help.

 

Many thanks

Categories:
I have the same question (0)
  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @Adam_Lpl 

     

    To delete the file you need the identifier. Please follow the below.

    image.png

  • Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Hi @Adam_Lpl,

     

    Can you try and replace the path and only use the dynamic value called Identifier from the Create File action instead? Let me know if that works 🙂

    fileidentifier.png

  • tom_riha Profile Picture
    10,185 Most Valuable Professional on at

    Hello @Adam_Lpl ,

    the 'Delete file' action expects 'File Identifier', that's a unique identifier of the file on the site, which is assigned when the file is created. You should use output from the 'Create file' action that provides you the 'Id' as a dynamic content.image.png

  • Adam_Lpl Profile Picture
    32 on at

    Thanks @abm 

     

    I should have showed the full flow as there are multiple document creations and a SharePoint list modification.  When I use ID as the File Identifier it deletes the item from my SharePoint list which triggered the flow instead of the document I want deleting.  Is there a way of identifying the correct item to be deleted in the file identifier amongst the various items created in my flow below?

     

    Adam_Lpl_0-1606485318733.png

    I've put a red X next to the document I want deleting.  Rest of flow to follow:

    Adam_Lpl_1-1606485376297.png

    Thanks @abm 

     

    I should have showed the full flow as there are multiple document creations and a SharePoint list modification.  When I use ID as the File Identifier it deletes the item from my SharePoint list which triggered the flow instead of the document I want deleting.  Is there a way of identifying the correct item to be deleted in the file identifier amongst the various items created in my flow below?

     

    Adam_Lpl_0-1606485318733.png

    I've put a red X next to the document I want deleting.  Rest of flow to follow:

    Adam_Lpl_1-1606485376297.pngAdam_Lpl_2-1606485398734.png

     

  • Adam_Lpl Profile Picture
    32 on at

    Thanks @Expiscornovus 

     

    I should have showed the full flow as there are multiple document creations and a SharePoint list modification.  When I use ID as the File Identifier it deletes the item from my SharePoint list which triggered the flow instead of the document I want deleting.  Is there a way of identifying the correct item to be deleted in the file identifier amongst the various items created in my flow below?

     

    Adam_Lpl_0-1606485318733.png

    I've put a red X next to the document I want deleting.  Rest of flow to follow:

    Adam_Lpl_1-1606485376297.png

    Thanks @abm 

     

    I should have showed the full flow as there are multiple document creations and a SharePoint list modification.  When I use ID as the File Identifier it deletes the item from my SharePoint list which triggered the flow instead of the document I want deleting.  Is there a way of identifying the correct item to be deleted in the file identifier amongst the various items created in my flow below?

     

    Adam_Lpl_0-1606485318733.png

    I've put a red X next to the document I want deleting.  Rest of flow to follow:

    Adam_Lpl_1-1606485376297.pngAdam_Lpl_2-1606485398734.png

     

  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @Adam_Lpl 

    It would be easier to split this into two flows. One for creating the files. Next you could use the below trigger to start the flow for your approval process.

     

    image.png

  • Adam_Lpl Profile Picture
    32 on at

    Thanks @abm 

     

    sorry to be a pain but splitting doesn’t work for me.  The approval process need to contain all of the data from the SharePoint list and the creation of the document needs to happen  before the approval for regulatory reasons.

     

    I think there may be another way of approaching this without deleting the file.

     

    the only reason I’m trying to delete the file created earlier in the flow is because if the approval is rejected the user needs to amend the data in the SharePoint list to correct it.  This triggers the flow again but it then fails as the file it’s trying to create before the approval already exists.

     

    Is there a condition I could put in so it skips the document creation step altogether under certain conditions? That would leave the original document created there but not make the flow fail.

     

    sorry need your expertise on this one.  It’s making my head hurt!

     

    thanks

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard