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 / Ge SharePoint File Ide...
Power Automate
Answered

Ge SharePoint File Identifier by Name

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

I am trying to get the Identifier of a file in SharePoint by its filename so I can delete it. The file came from a Form and I get the filename with:

 

 

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

 

 

When I use "Get files (properties only)" with a Filter Query of:

 

 

FilenameWithExtension eq '@{first(body('Parse_Dust_Blown_Out_Photo_JSON'))['name']}'

 

 

It says the file is not found.

 

When I don't use a Filter Query and I output the "Get files (properties only)", it shows the file is there:

 

 

[
 {
 "ID": 562,
 "{Name}": "bruce-banner_Adam Haas",
 "{FilenameWithExtension}": "bruce-banner_Adam Haas.jpg",
 "{Path}": "Shared Documents/Apps/Microsoft Forms/Daily Mulch Checklist/Photo of Dust Blown Out/",
 "{FullPath}": "Shared Documents/Apps/Microsoft Forms/Daily Mulch Checklist/Photo of Dust Blown Out/bruce-banner_Adam Haas.jpg",
 "{IsCheckedOut}": false,
 }
]

 

 

IPC_ahaas_0-1663943124858.png

 

So what am I doing wrong?

Categories:
I have the same question (1)
  • Verified answer
    Pstork1 Profile Picture
    68,707 Most Valuable Professional on at

    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
  • IPC_ahaas Profile Picture
    1,387 Moderator on at

    Thank you! That is so much simpler as I don't need to get the file details since I already have them. This worked great.

  • Baytars Profile Picture
    10 on at

    That action never says we have to encode the path.☹️

  • Pstork1 Profile Picture
    68,707 Most Valuable Professional on at

    If you use the regular dynamic content you don't have to encode the path.  But if you build the path from scratch as a string you do need to encode it or you'll get an error because it doesn't know how to handle the special characters.  The docs rarely discuss how to enter raw content into these fields.

  • Baytars Profile Picture
    10 on at

    @Pstork1 wrote:

    If you use the regular dynamic content you don't have to encode the path.  But if you build the path from scratch as a string you do need to encode it or you'll get an error because it doesn't know how to handle the special characters.


    I first used dynamic content to check if I input in the correct format. The path looks unencoded. Before I saw this post, I never know what was wrong. Thank you!

     


    @Pstork1 wrote:

    The docs rarely discuss how to enter raw content into these fields.


    Thanks to my experience as a web developer, I know `encodeURIComponent` does this job.

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 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard