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

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Cannot Delete File from SharePoint

(0) ShareShare
ReportReport
Posted on by 1,374 Moderator

Really struggling to see why this is so difficult. Currently I have a Form with attachments.

The file is stored in a Team Site and I re-create the file in another Site, this works fine.

I now want to delete the original file.

 

I parse the JSON for the Form and I get the id and referenceId.

IPC_ahaas_0-1663870891903.png

"Get file properties 2" requires the id, so I use 

first(body('Parse_Dust_Blown_Out_Photo_JSON'))['id']

IPC_ahaas_1-1663871027854.png

 

"Delete file" requires he identifier, so I use

outputs("Get_file_properties_2')?['body/{Identifier}']

IPC_ahaas_2-1663871079432.png

I get an error on "Get file properties 2"

IPC_ahaas_3-1663871127532.png

 

"OpenApiOperationParameterTypeConversionFailed. The 'inputs.parameters' of workflow operation 'Get_file_properties_2' of type 'OpenApiConnection' is not valid. Error details: Input parameter 'id' is required to be of type 'Integer/int64'. The runtime value '"01TT7QJCM3ZZYGZ27XVRG2GBHZGATFRSCI"' to be converted doesn't have the expected format 'Integer/int64'."

 

What does that mean and how do I fix this?

I have the same question (0)
  • Sundeep_Malik Profile Picture
    6,484 on at
    Re: Cannot Delete File from SharePoint

    Hey @IPC_ahaas 

    Not sure this will help you or not. Same error in a previous post:

     

    https://powerusers.microsoft.com/t5/Building-Flows/Grand-access-to-a-folder/m-p/939984

  • IPC_ahaas Profile Picture
    1,374 Moderator on at
    Re: Cannot Delete File from SharePoint

    This doesn't help, it's not related. The link refers to granting access to a folder and they get the error because they referred to the name of the Library by Path rather than by Name.

     

    My Parse JSON targets the attachment from the Form already gets a lot of information about the file:

    [
     {
     "name": "bruce.jpg",
     "link": "https://contoso.sharepoint.com/sites/IT/Shared%20Documents/Apps/Microsoft%20Forms/Daily%20Mulch%20Checklist/Photo%20of%20Dust%20Blown%20Out/bruce.jpg",
     "id": "01TT7QJCM3ZZYGZ27XVRG2GBHZGATFRSCI",
     "type": null,
     "size": 166458,
     "referenceId": "01TT7QJCLFCRXKIUQSIRH3ZATTFDETZY44",
     "driveId": "b!id-JSZvmn0G2u3oXHNGg2E-DBpB3LMJIustV5fDElhdIbRT0JJzgSrqCCmOmtYok",
     "status": 1,
     "uploadSessionUrl": null
     }
    ]

    So I have the id, unless this is somehow a different "id" than the actual one for the file.

     

    I tried using "Get files (properties only) to target the file by FilenameWithExtension and for some reason that didn't work either.

     

  • IPC_ahaas Profile Picture
    1,374 Moderator on at
    Re: Cannot Delete File from SharePoint

    I am trying to get the FilenameWithExtension which seems like a subject of Value. How can I target it?

     

    IPC_ahaas_1-1663875989581.png

     

  • Verified answer
    IPC_ahaas Profile Picture
    1,374 Moderator on at
    Re: Cannot Delete File from SharePoint

    This was solved via another of my posts thanks to @Pstork1 

     

    Solved: Re: Ge SharePoint File Identifier by Name - Power Platform Community (microsoft.com)

     

     

     

    The file identifier is the relative path to the file, but it needs to be encoded so that all the special characters are changed to their HTML equivalents.

    So if the file name is test.txt and its stored in Folder 1 of the Shared Documents library in SharePoint then the relative path is

    /Shared Documents/folder 1/test.txt

    Putting that inside a encodeUriComponent() provides the following output which is the file identifier.

    %2FShared%20Documents%2Ffolder%201%2Ftest.txt
     

     

  • Community Power Platform Member Profile Picture
    on at
    Help I have the same issue

    sfceurope_0-1666618874737.png

    Simple, I have to delete all the files from the folder "invoices". Nothing happend.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 655 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 371 Moderator

#3
chiaraalina Profile Picture

chiaraalina 276

Last 30 days Overall leaderboard