cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
simondpalmer
Helper II
Helper II

List document libraries from Powerapp selected Sharepoint site

I have a flow (ListSites) getting all sharepoint sites for a powerapp user to select and I want to take it one step further and get all document libraries for selected site. I have the the following flow which works well in PowerApps:

 

ListSites - Works wellListSites - Works well

 

Now I have the following to select Document Libraries for the selected site. How do I do that? Below is what I have tried:

 

ListLibraries - From Selected SiteListLibraries - From Selected Site

Please help

1 ACCEPTED SOLUTION

Accepted Solutions

I understand - that particular blog "page" is part of what is more like a book than a blog 😂.

https://masteroffice365.com/powerapps/

 

I realize now that I used a really bad permalink being "powerapps" for the main blog page. The entire blog would explain everything you ever wanted to know about using the Graph v2 APIs with Power Apps but I should be giving that lesson in a classroom on that ha-ha.

 

Back to your specific requirements - the flow in the blog retrieves the complete collection of lists and libraries in the site passed in as an input parameter when running the flow. In your case that would be "sites/9999_SharefileTesting". For the broader context of the rest of the flows in that blog I wanted a single flow that returned both the lists as well as libraries on any given site as opposed to splitting it into 2 flows (because there are already a lot of other flows).

 

The way the "Get Site Lists And Libraries" and "Get Site Document Libraries" flow steps interact is that every library is in fact equally a list. In other words a library is in essense a type of list with additional properties. Most likely you can use either of these 2 steps in the flow. You shouldn't need to use both. 

 

In the "Get Site Lists And Libraries" step for the Uri generated when running the flow will look along the lines of:

"_api/v2.0/sites/tentant.sharepoint.com:/teams/AllThings365:/lists?$select=id,name,webUrl,displayName,system,list"

The list field in the $select is a complex field which include a type "sub-field" from which you can determine whether the record is a List or Document Library (i.e genericList or documentLibrary).

 

The "Get Site Document Libraries" step will return additional data specific to a document library, primarily things such as the number of files in the library and total size of the library and a few other things. The Uri generated for this step would typically look as follows:

"_api/v2.0/sites/tenant.sharepoint.com:/teams/AllThings365:/drives?$select=id,name,webUrl,driveType,quota,system"

 

If you don't include system in the $select you won't get the Site Assets library returned in either step. If you do include it you are going to get other hidden libraries such Web Part Gallery as which you may not want.

 

By the sounds of it you should only need to implement the "Get Site Document Libraries" step in your flow. You are welcome to test out the flow I've now shared on Github to see all the outputs of each step.

https://github.com/Office365Master/Adhoc-Power-Automate-Flows

 

Should subsequently need to retrieve display the files and folders in any given library I'd highly recommend reading the full blog because it really is the ultimate way to surface dynamic data sources, from search for a site, retrieving a collection of lists and libraries in a site, retrieving a list of files and folders in a library, retrieving files and folders in any given folder of a document library, list items in additional to version  history. The Graph APIs can return up to 5000 items in a single query as opposed to the Power Apps max 2000 row limit. 

 

https://masteroffice365.com/powerapps/

 

Flows-Hierarchical-Structure.jpeg

 

 

 

 

View solution in original post

3 REPLIES 3
Office365Master
Advocate V
Advocate V

This blog should give you all the insight you need 😉

https://masteroffice365.com/powerapps/3/#PA_Graph_Site_List_Libraries

Thank you, I have looked at that blog. Though it has been extremely 🙂 helpful it is a bit unclear how the "Site" input is derived (Data Operation: Select?) and then how can accessing a specific Document library (Get Site Lists And Libraries) fits in the chain of actions? I guess what is the difference between "Get Site Lists And Libraries" and "Get Site Document Libraries" flow steps and how do they interact?

In a nutshell, I want the user to be able to access the document libraries based on what "Site" has been selected in powerapps. Example address here: https://tenantname.sharepoint.com/sites/9999_SharefileTesting/Images1/Forms/AllItems.aspx

I understand - that particular blog "page" is part of what is more like a book than a blog 😂.

https://masteroffice365.com/powerapps/

 

I realize now that I used a really bad permalink being "powerapps" for the main blog page. The entire blog would explain everything you ever wanted to know about using the Graph v2 APIs with Power Apps but I should be giving that lesson in a classroom on that ha-ha.

 

Back to your specific requirements - the flow in the blog retrieves the complete collection of lists and libraries in the site passed in as an input parameter when running the flow. In your case that would be "sites/9999_SharefileTesting". For the broader context of the rest of the flows in that blog I wanted a single flow that returned both the lists as well as libraries on any given site as opposed to splitting it into 2 flows (because there are already a lot of other flows).

 

The way the "Get Site Lists And Libraries" and "Get Site Document Libraries" flow steps interact is that every library is in fact equally a list. In other words a library is in essense a type of list with additional properties. Most likely you can use either of these 2 steps in the flow. You shouldn't need to use both. 

 

In the "Get Site Lists And Libraries" step for the Uri generated when running the flow will look along the lines of:

"_api/v2.0/sites/tentant.sharepoint.com:/teams/AllThings365:/lists?$select=id,name,webUrl,displayName,system,list"

The list field in the $select is a complex field which include a type "sub-field" from which you can determine whether the record is a List or Document Library (i.e genericList or documentLibrary).

 

The "Get Site Document Libraries" step will return additional data specific to a document library, primarily things such as the number of files in the library and total size of the library and a few other things. The Uri generated for this step would typically look as follows:

"_api/v2.0/sites/tenant.sharepoint.com:/teams/AllThings365:/drives?$select=id,name,webUrl,driveType,quota,system"

 

If you don't include system in the $select you won't get the Site Assets library returned in either step. If you do include it you are going to get other hidden libraries such Web Part Gallery as which you may not want.

 

By the sounds of it you should only need to implement the "Get Site Document Libraries" step in your flow. You are welcome to test out the flow I've now shared on Github to see all the outputs of each step.

https://github.com/Office365Master/Adhoc-Power-Automate-Flows

 

Should subsequently need to retrieve display the files and folders in any given library I'd highly recommend reading the full blog because it really is the ultimate way to surface dynamic data sources, from search for a site, retrieving a collection of lists and libraries in a site, retrieving a list of files and folders in a library, retrieving files and folders in any given folder of a document library, list items in additional to version  history. The Graph APIs can return up to 5000 items in a single query as opposed to the Power Apps max 2000 row limit. 

 

https://masteroffice365.com/powerapps/

 

Flows-Hierarchical-Structure.jpeg

 

 

 

 

View solution in original post

Helpful resources

Announcements
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MSFTBizAppsLaunchEvent

Experience what’s next for Power Virtual Agents

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Users online (69,937)