Forum Discussion
Dynamic data source
Hi,
I have multiple excel files on subsite teams/SharePoint folders.
I have created a function to get all the files at once but since it is a dynamic data source, it can not refresh in the Service.
Web.Contents /RelativePath method does not work since there is an authentication needed to access the SharePoint folders online.
and to my knowledge Web.Contents is only allowed as anonymous.
Any tips or tricks or is it wait until dynamic data source is available?
- Anonymous4 years ago
Sorry Anonymous, but I not sure the Power BI will let you this because of the way the Credential are effectively stored.
Rather than storing a single credential for https://xxxxxxxxxxx.sharepoint.com/ the service will be trying to create one for each https://xxxxxxxxxxx.sharepoint.com/sites/xxxxx-"&Company. The service may not allow the company to change because it leads to the credential change or the need for new credentials. New Credentials will require you into the dataset settings to update.
The Web.Contents relative path feature is really for API calls. It allows the main part of the web address to be stored for credential purposes while allowing the whole web address to change. I think in your case https://xxxxxxxxxxx.sharepoint.com/sites/xxxxx-"&Company is part of the main address.Do you really need it to be Dynamic or are you merely trying to create a PBI Template that asks for the new Site.
10 Replies
- AnonymousNot applicable
Sorry Anonymous, but I not sure the Power BI will let you this because of the way the Credential are effectively stored.
Rather than storing a single credential for https://xxxxxxxxxxx.sharepoint.com/ the service will be trying to create one for each https://xxxxxxxxxxx.sharepoint.com/sites/xxxxx-"&Company. The service may not allow the company to change because it leads to the credential change or the need for new credentials. New Credentials will require you into the dataset settings to update.
The Web.Contents relative path feature is really for API calls. It allows the main part of the web address to be stored for credential purposes while allowing the whole web address to change. I think in your case https://xxxxxxxxxxx.sharepoint.com/sites/xxxxx-"&Company is part of the main address.Do you really need it to be Dynamic or are you merely trying to create a PBI Template that asks for the new Site.
- AnonymousNot applicable
I see what you mean, thanx for the explanation!
The dynamic part is to get all files at once rather than adding the files one by one and the creation of a lot of transform files.- AnonymousNot applicable
Thanks Anonymous - note if you want to get a list of all the files. Can I suggest using the SharePoint.Contents or SharePoint.Files power query functions. But I recommend using the Implemention version 2.0. It is faster and more stable than the older api.
SharePoint.Contents( #"SharePoint Site", [Implementation="2.0"] )
SharePoint.Tables( #"SharePoint Site", [Implementation="2.0"] )
SharePoint.Files( #"SharePoint Site", [Implementation="2.0"] )After this point, you can use the standard table filters in Power Query rather than messing around with URL strings.
- AnonymousNot applicable
Web.Contents will work. As long as you do not hard set the "Authorization" header, it should be handled by by the engine. RelativePath is the way to go to avoid the dynamic data source warning
- AnonymousNot applicable
What do you mean by "not hard set the authorization header":
My case is:
https://xxxxxxxxxxx.sharepoint.com/sites/xxxxx-CompanyCompany is the name of the private channels on teams, so this should be dynamic to get all the files from each channel. There are multiple excel files in each channel as well.
My current method to do this(dynamic data source) and works in desktop is:
let
Source = (names as text) =>
let
Source = SharePoint.Files("https://xxxxxxxxxxx.sharepoint.com/sites/xxxxx-"&Company, [ApiVersion = 15])
in
Source
in
Source
- AnonymousNot applicable
Hi Anonymous,
The Url your using is dynamic. Unfortunately there is no relativePath param using sharepoint.files. You'll have to use web.contents. Please have a look at https://community.powerbi.com/t5/Service/Web-Contents-with-dynamic-file-URL/m-p/928233
- AnonymousNot applicable
Thx, for the link!
Keep getting authentication issues.
- AnonymousNot applicable
Hi Anonymous ,
Could you tell me if your problem has been solved?
If it is, kindly Accept the helpfu reply as the solution. More people will benefit from it.
Or you are still confused about it, please provide me with more details about your problem.
Best Regards,
Stephen Tao - AnonymousNot applicable
hey, did you solve this issue ? if yes, it would be great to share it