Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

How to set up function to get files without triggering Dynamic Data warning

Hi, I have to gather several files from the same folder in Sharepoint. I developed a function that receives a folder and a file name and returned me bytes, to use with the appropriate connector, like CSV.Document or Parquet.Document, for example. 

 

(folder as text, file as text)=>
let
// splits url path using forward slash, remember to strip /:r:/
// then get first 5 pieces to build sharepoint folder url
sharepoint_path = Text.Combine(List.Range(Text.Split(folder, "/"), 0,5), "/"),
sharepoint_folder = SharePoint.Files(sharepoint_path, [ApiVersion = 15]),

//replace '%20' for space
folder_path = Text.Replace(folder, "%20", " "),
filter_files = Table.SelectRows(sharepoint_folder, each ([Folder Path] = folder_path)),
bytes = Table.SelectRows(filter_files, each (Text.Contains([Name], file)))[Content]{0}
in
bytes

My problem is: 
This functions triggers the Dynamic Data Source warning. And this makes the report unable to schedule a refresh in Power BI service. 


Have anyone bumped in this kind of problem? Have you found any workaround for this?
Best regards 


No Replies