Skip to main content

Notifications

Community site session details

Community site session details

Session Id : qQFgJ/0PHcMT9GDuq3jv3u
Power Automate - Building Flows
Answered

Ge SharePoint File Identifier by Name

Like (0) ShareShare
ReportReport
Posted on 23 Sep 2022 14:25:42 by 1,272 Super User 2025 Season 1

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?

  • Baytars Profile Picture
    10 on 01 Mar 2023 at 01:11:47
    Re: Ge SharePoint File Identifier by Name

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

  • Pstork1 Profile Picture
    65,999 Most Valuable Professional on 28 Feb 2023 at 22:51:11
    Re: Ge SharePoint File Identifier by Name

    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 28 Feb 2023 at 15:43:32
    Re: Ge SharePoint File Identifier by Name

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

  • IPC_ahaas Profile Picture
    1,272 Super User 2025 Season 1 on 23 Sep 2022 at 15:25:26
    Re: Ge SharePoint File Identifier by Name

    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.

  • Verified answer
    Pstork1 Profile Picture
    65,999 Most Valuable Professional on 23 Sep 2022 at 14:34:20
    Re: Ge SharePoint File Identifier by Name

    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

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,653 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,999 Most Valuable Professional

Leaderboard
Loading started