Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowJuly 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more
Dear Microsoft Team,
I’m facing an issue with Power BI Service refresh when using dynamic SharePoint APIs via Web.Contents, while the same dataset refreshes successfully in Power BI Desktop.
TenantRoot = "https://mccnetmccneb.sharepoint.com",
// --- Projects from ProjectsHub ---
ProjectsHubRel = "/sites/ProjectsHub/_api/web/lists/getbytitle('Projects')/items",
ProjectsRaw = Web.Contents(
TenantRoot,
[
RelativePath = ProjectsHubRel,
Query = [
#"$select"="Title",
#"$top"="10000",
#"$format"="json"
],
Headers = [
Accept="application/json;odata=verbose"
]
]
),
✅Refresh works perfectly in Power BI Desktop
✅Data is fetched correctly from all project sites
Refresh fails with:
Data source error: The credentials provided for the Web source are invalid. (Source at https://mccnetmccneb.sharepoint.com/sites/ProjectsHub/_api/web/lists/getbytitle('Projects')/items.). The exception was raised by the IDbCommand interface.
Cluster URI: WABI-US-NORTH-CENTRAL-J-PRIMARY-redirect.analysis.windows.net
Even though:
I noticed that SharePoint sometimes returns XML (ATOM feed) instead of JSON
I am now trying to enforce JSON using:
Still facing refresh issues in Service
Has anyone successfully implemented:
✅Dynamic SharePoint site calls using Web.Contents
✅Across multiple site URLs
✅With reliable refresh in Power BI Service
Thanks,
Purva Shah
Solved! Go to Solution.
Hi @Purva_2504,
The fact that the query refreshes in Power BI Desktop but fails in the Service suggests the issue may be with how the Service handles dynamically built SharePoint paths, rather than with authentication. Even if TenantRoot and RelativePath are fixed, the Service may still treat the source as dynamic when RelativePath values are assembled from site URLs retrieved during query execution. As a troubleshooting step, hard-code a single project site path in RelativePath and test the refresh in the Service. If that works, it would indicate that dynamic path generation is contributing to the refresh failure.
Thank you.
Hi @Purva_2504,
Have you had a chance to review the solution we shared earlier? If the issue persists, feel free to reply so we can help further.
Thank you.
Hi, Thank you for sharing solution, but issue is still persist, It is giving same error
Hi @Purva_2504,
The fact that the query refreshes in Power BI Desktop but fails in the Service suggests the issue may be with how the Service handles dynamically built SharePoint paths, rather than with authentication. Even if TenantRoot and RelativePath are fixed, the Service may still treat the source as dynamic when RelativePath values are assembled from site URLs retrieved during query execution. As a troubleshooting step, hard-code a single project site path in RelativePath and test the refresh in the Service. If that works, it would indicate that dynamic path generation is contributing to the refresh failure.
Thank you.
Ok
Hi @Purva_2504,
Checking in to see if your issue has been resolved. let us know if you still need any assistance.
Thank you.
Hi @Purva_2504 ,
Thanks for Your problem.
This is a scenario where dynamic Web.Contents calls to multiple SharePoint site URLs behave differently between Power BI Desktop and the Power BI Service. The root cause is that the Service enforces stricter rules around dynamic data source paths and credential scoping.
Workarounds-
1. Use RelativePath with a Fixed Root
This ensures the Service sees one consistent root domain
2. Parameterize Site URLs Safely-
3. Enable Allow Data Source to Combine-
4. Force JSON Output
5. Consider Staging-
If dynamic expansion remains unstable, stage project/task lists into a single SharePoint list or Fabric Lakehouse.
Refresh against that consolidated source instead of looping through sites at runtime.
Microsoft has documented that dynamic Web.Contents across multiple site collections is not fully supported in Service.
The recommended architecture is to normalize site data into one source or use SharePoint Folder connector for consistent refresh.
If this reply helped, a kudos would mean a lot and mark it as a solutions .It encourages contributors and keeps the community strong.
Thank You
Sunita
Hi Sunita,
Thank you for the detailed explanation and suggestions, they were very helpful.
I have implemented the changes you recommended:
In Power BI Desktop, everything works correctly. I am able to retrieve data dynamically from multiple project sites, and I also verified that the API responses are returning JSON and being parsed correctly (d → results) in Power Query.
However, in Power BI Service, I am still encountering the same error:
“The credentials provided for the Web source are invalid.”
Since I am relatively new to Power BI, I’m not sure if there might still be an issue in my query or approach.
From further testing, it seems the query is dynamically expanding across multiple SharePoint site URLs, which might still be treated as a dynamic data source during refresh.
If possible, could you please review or suggest improvements to the query pattern? Also, have you seen any alternative approaches to support a fully dynamic multi-site scenario without using a staging layer?
Thanks again for your guidance!
Hi @Purva_2504,
Thank you @trivedisunita, for your insights.
Since the query refreshes successfully in Power BI Desktop but fails in the Power BI Service, this could be due to how the Service manages dynamically generated SharePoint site paths, rather than an issue with credentials. Even though you have set a fixed tenant root using Web.Contents and RelativePath, if the site paths are constructed at runtime from the Projects list, the Service might still treat the query as a dynamic data source. You could try hard-coding a single project site path to see if the refresh works in the Service. If it does, this suggests that the dynamic URL generation may be causing the issue. Microsoft’s documentation on dynamic data sources and Web.Contents could provide further guidance.
Data refresh in Power BI - Power BI | Microsoft Learn
Web.Contents - PowerQuery M | Microsoft Learn
Thank you.
Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.
If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!
Check out the July 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 17 | |
| 8 | |
| 6 | |
| 6 | |
| 5 |