cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
stvcdms
Level 8

How to get folder ID in SharePoint

Hello,

 

I am trying to get a folder ID to use List Folder, but to do that I need the ID. When I use Get File Metadata Using Path I get an error that the folder doesn't exist. I am guessing because that REST call expects a file not a folder. Is there a way to get a Folder ID with the path name?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
khwilhelmsen
Level: Power Up

Re: How to get folder ID in SharePoint

Hi,

 

I've been strugling with the same problem for some hours and found a solution to make dynamic url folder string that I can use as a parameter to the "List Folder" block.

 

This was my solution:

replace(replace(body('Get_item')?['{Path}'],'/','%252f'),' ','%2b')

 

The "body('Get_item')?['{Path}']" part of the line is the variable.

 

This worked for me 😉

View solution in original post

6 REPLIES 6
Community Support Team
Community Support Team

Re: How to get folder ID in SharePoint

Hi @stvcdms,

 

If you know the actual folder name, then we may use the following way to get the corresponding Folder ID:

22.PNG

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
stvcdms
Level 8

Re: How to get folder ID in SharePoint

Thanks, this is party helpful. Though after playing with this more, it turns out List Folder isn't useful... I mean it's getting pretty frustrating now, but List Folder doesn't appear to work properly with subsites.

 

You can't provide List Folder with dynamic site address parameters or build the URL from the folder parameter...

Highlighted
khwilhelmsen
Level: Power Up

Re: How to get folder ID in SharePoint

Hi,

 

I've been strugling with the same problem for some hours and found a solution to make dynamic url folder string that I can use as a parameter to the "List Folder" block.

 

This was my solution:

replace(replace(body('Get_item')?['{Path}'],'/','%252f'),' ','%2b')

 

The "body('Get_item')?['{Path}']" part of the line is the variable.

 

This worked for me 😉

View solution in original post

stvcdms
Level 8

Re: How to get folder ID in SharePoint

Thanks for this. I ended up doing something similiar, but with hard coding, your formula is most useful!

khwilhelmsen
Level: Power Up

Re: How to get folder ID in SharePoint

BTW found out the since I’m building up a folderpath by both dynamic and static data it was best to store it as a variable and run a CONCAT to combine.

Wasn’t able to use REPLACE inside the CONCAT 😉
craig_lawrence
Level: Power Up

Re: How to get folder ID in SharePoint

Hi I know this is an old thread, but could you please provide guidance as to how you used the provided variable within the flow? (Screenshots like the original reply would be great!

 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (7,807)