Forum Discussion
Get all files from onedrive folder in an efficient way
- 6 years ago
Yes. In the SOURCE line of the query, change SharePoint.Files("http://blahblah") to SharePoint.Contents("http://blahblah")
You will be at the root of the sharepoint site. You'll have to navigate through to the desired folder, but the end result will ignore all other folders when your query runs.
- 6 years ago
Change your source to this:
Source = SharePoint.Contents("https://sharepoint_site_root_name", [ApiVersion = 15]),See if that helps.
I'm not sure why it would take a long time to browse, unless the folder you are accessing has hundreds or thousands of files in that folder. It does have to load the full listing of the folder you ultimately get a file(s) from.
Thanks for reply,
Tried that but still first and next time query processing duration is super long, like 10 minutes. Looks like navigating to Documents folder slows processing (row #2). When running query Queries & Connection tab showing it downloading ~50mb of metadata to show just what Documents folder has....
Here is code snippet i use to navigating through to the desired folder:
Source = SharePoint.Contents("https://sharepoint_site_root_name"),
Documents = Source{[Name="Documents"]}[Content],
MyTargetFolder = Documents{[Name="MyTargetFolder"]}[Content],
Change your source to this:
Source = SharePoint.Contents("https://sharepoint_site_root_name", [ApiVersion = 15]),
See if that helps.
I'm not sure why it would take a long time to browse, unless the folder you are accessing has hundreds or thousands of files in that folder. It does have to load the full listing of the folder you ultimately get a file(s) from.
- Anonymous6 years agoNot applicable
Hi sashaxp
As far as I understand the users refresh data from PBI Desktop?
Depending on the license available, do you want to consider creating a dataflow or separate PBI dataset to update the underlying data every time any file in the Sharepoint folder is updated? This can be done using MS Flow and PBI REST API bridge.
The user dataset/reports can be hooked into this central data. Refreshing from dataflow or another PBI is close to instant (depending on the size of the actual underlying dataset).
Kind regards,
JB
- sashaxp6 years ago
Advocate I
Hi Anonymous;
Thanks for suggestion, but at the moment i am trying to make it simple and also slow processing solved as per @edhans suggestions on using SharePoint.Contents instead of SharePoint.Files api calls.
- sashaxp6 years ago
Advocate I
Hi edhans,
I've changed source to include ApiVersion and now everything works super fast.
Thanks a lot!
- edhans6 years ago
Community Champion
Cool. I don't know exactly what the ApiVersion does, but I do know it limits how many files it pulls (low thousands). If using SharePoint.Contents() that shouldn't be an issue since an individual folder should not have thousands of files in general. So it stops PowerBI from pulling endlessly to get all of the file and folder names. It has a decent effect on SharePoint.Files, but apparently a huge effect on SharePoint.Conents()!