<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Sharepoint Authentication fails when using Web.Contents with RelativePath on files in Power Query</title>
    <link>https://community.fabric.microsoft.com/t5/Power-Query/Sharepoint-Authentication-fails-when-using-Web-Contents-with/m-p/4773915#M153298</link>
    <description>&lt;P&gt;But this is leading exactly to the initial problem again: I expect a huge number of files in the same Sharepoint. If the connector now pulls first all files (even if only the meta-datA) it takes ages to refresh only to filter down to a few afterwards?!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I need a away to pull individual files (for which I know the path though) AND extract the contents with working authentication...&lt;/P&gt;</description>
    <pubDate>Wed, 23 Jul 2025 15:23:09 GMT</pubDate>
    <dc:creator>AlexR_DE</dc:creator>
    <dc:date>2025-07-23T15:23:09Z</dc:date>
    <item>
      <title>Sharepoint Authentication fails when using Web.Contents with RelativePath on files</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Sharepoint-Authentication-fails-when-using-Web-Contents-with/m-p/4767887#M153149</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to build a report that reads a bunch of Excel Files in a Sharepoint document library.&lt;/P&gt;&lt;P&gt;They are stored in the same Sharepoint site.&lt;/P&gt;&lt;P&gt;If I load them directly via Web.Contents([URL]), they load perfectly after I authenticate once.&lt;BR /&gt;Unfortunately, this does not allowe refresh online. Hence I modified it to use the same, static base_url and put the dynamic part into [RelativePath]. But now the process is stuck whenever it loaded a file - it always asks for authentication, but fails each time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have attached 2 screenshots that show the result. Any advice on how I can upload a demo pbix?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jul 2025 06:49:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Sharepoint-Authentication-fails-when-using-Web-Contents-with/m-p/4767887#M153149</guid>
      <dc:creator>AlexR_DE</dc:creator>
      <dc:date>2025-07-18T06:49:33Z</dc:date>
    </item>
    <item>
      <title>Re: Sharepoint Authentication fails when using Web.Contents with RelativePath on files</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Sharepoint-Authentication-fails-when-using-Web-Contents-with/m-p/4767936#M153152</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1272812" data-lia-user-login="AlexR_DE" class="lia-mention lia-mention-user"&gt;AlexR_DE&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a specific reason you're not using the SharePoint Folder connector? It's designed to do exactly what it appears you're trying to achieve.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/power-query/connectors/sharepoint-folder" target="_blank"&gt;Power Query SharePoint folder connector - Power Query | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Pete&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jul 2025 07:18:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Sharepoint-Authentication-fails-when-using-Web-Contents-with/m-p/4767936#M153152</guid>
      <dc:creator>BA_Pete</dc:creator>
      <dc:date>2025-07-18T07:18:38Z</dc:date>
    </item>
    <item>
      <title>Re: Sharepoint Authentication fails when using Web.Contents with RelativePath on files</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Sharepoint-Authentication-fails-when-using-Web-Contents-with/m-p/4768085#M153158</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Yes, I am using a custom REST query to extract all files, because I expect loads of files (10.000+) in that folder and that will not work with the connector in a performing way...&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jul 2025 08:39:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Sharepoint-Authentication-fails-when-using-Web-Contents-with/m-p/4768085#M153158</guid>
      <dc:creator>AlexR_DE</dc:creator>
      <dc:date>2025-07-18T08:39:00Z</dc:date>
    </item>
    <item>
      <title>Re: Sharepoint Authentication fails when using Web.Contents with RelativePath on files</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Sharepoint-Authentication-fails-when-using-Web-Contents-with/m-p/4768397#M153164</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1272812" data-lia-user-login="AlexR_DE" class="lia-mention lia-mention-user"&gt;AlexR_DE&lt;/a&gt;,&amp;nbsp;&lt;BR /&gt;Thank you for posting your query in Microsoft Fabric Community Forum. Also, thanks to&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="115827" data-lia-user-login="BA_Pete" class="lia-mention lia-mention-user"&gt;BA_Pete&lt;/a&gt;,&amp;nbsp;for those inputs on this thread. &lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Thanks for sharing the details and screenshots they really helped clarify the issue. You're right that using the full URL with Web.Contents() works, but unfortunately, switching to RelativePath causes authentication to fail, even when credentials are entered correctly.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;This happens because Web.Contents() with RelativePath does not fully support OAuth2 authentication for SharePoint Online. Power BI is unable to apply the correct auth context when only a partial path is passed this is a known limitation.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;To get around this and ensure your report can refresh in the Power BI Service, I’d recommend switching to SharePoint.Contents. This connector is designed to work smoothly with SharePoint authentication and online refresh scenarios.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Here is how the structure would look using SharePoint.Contents:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;let

    siteUrl = "https://yourtenant.sharepoint.com/sites/yoursite",

    files = SharePoint.Contents(siteUrl),

    folder = Table.SelectRows(files, each [Folder Path] = siteUrl &amp;amp; "/Shared Documents/your-folder-name/"),

    excelFiles = Table.SelectRows(folder, each Text.EndsWith([Name], ".xlsx")),

    loadBinary = Table.AddColumn(excelFiles, "GetBinary", each [Content])

in

    loadBinary&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;You can then filter dynamically by filename or path without needing to hardcode URLs or use RelativePath.&lt;/P&gt;
&lt;P&gt;If you’d like more detail on the differences between Web.Contents and SharePoint.Contents, the following articles may help:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/powerquery-m/sharepoint-contents" target="_blank"&gt;SharePoint.Contents - PowerQuery M | Microsoft Learn&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://learn.microsoft.com/en-us/power-query/handling-status-codes" target="_blank"&gt;Handling status codes with Web.Contents for Power Query connectors - Power Query | Microsoft Learn&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Hope this helps clarify things and let me know what you find after giving these steps a try happy to help you investigate this further.&lt;BR /&gt;&lt;BR /&gt;Thank you for using the Microsoft Community Forum.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jul 2025 11:44:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Sharepoint-Authentication-fails-when-using-Web-Contents-with/m-p/4768397#M153164</guid>
      <dc:creator>v-kpoloju-msft</dc:creator>
      <dc:date>2025-07-18T11:44:43Z</dc:date>
    </item>
    <item>
      <title>Re: Sharepoint Authentication fails when using Web.Contents with RelativePath on files</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Sharepoint-Authentication-fails-when-using-Web-Contents-with/m-p/4769743#M153207</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1272812" data-lia-user-login="AlexR_DE" class="lia-mention lia-mention-user"&gt;AlexR_DE&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;Just checking in to see if the issue has been resolved on your end. If the earlier suggestions helped, that’s great to hear! And if you’re still facing challenges, feel free to share more details happy to assist further.&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jul 2025 01:03:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Sharepoint-Authentication-fails-when-using-Web-Contents-with/m-p/4769743#M153207</guid>
      <dc:creator>v-kpoloju-msft</dc:creator>
      <dc:date>2025-07-21T01:03:25Z</dc:date>
    </item>
    <item>
      <title>Re: Sharepoint Authentication fails when using Web.Contents with RelativePath on files</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Sharepoint-Authentication-fails-when-using-Web-Contents-with/m-p/4770859#M153231</link>
      <description>&lt;P&gt;I now tried to use SharePoint.Contents - approach.&lt;/P&gt;&lt;P&gt;However, it seems to only scan the level you explicitely indicate - so it does not display all the elements nested on the folders below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;let
    siteUrl = SiteCollection,
    files = SharePoint.Contents(siteUrl),
    Documents = files{[Name="Documents"]}[Content],
    General = Documents{[Name="General"]}[Content],
    #"1_Workstreams" = General{[Name="1_Workstreams"]}[Content]
in
    #"1_Workstreams"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;any way to tell the connector to show all files under a specific level (in my example above, I'd like to show all entries from all folders underneath? So essentially recursively? Also I expect probably thousands of files (that was the reason for my REST approach).&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jul 2025 13:46:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Sharepoint-Authentication-fails-when-using-Web-Contents-with/m-p/4770859#M153231</guid>
      <dc:creator>AlexR_DE</dc:creator>
      <dc:date>2025-07-21T13:46:23Z</dc:date>
    </item>
    <item>
      <title>Re: Sharepoint Authentication fails when using Web.Contents with RelativePath on files</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Sharepoint-Authentication-fails-when-using-Web-Contents-with/m-p/4771359#M153237</link>
      <description>&lt;P&gt;Apparently, you can chain the folders on the Sharepoint Folder connector.&lt;/P&gt;&lt;P&gt;Any idea, how I can pass this based on a given URL?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So this works:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;let
    siteUrl = SiteCollection,
    files = SharePoint.Contents(siteUrl),
    Documents = Excel.Workbook(files{[Name="Documents"]}[Content]{[Name="General"]}[Content]{[Name="1_Workstreams"]}[Content]{[Name="9_Rollout"]}[Content]{[Name="excel_file.xlsx"]}[Content])
in
    Documents&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea, how I can get the above query to work with a path stored in a column?&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jul 2025 19:34:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Sharepoint-Authentication-fails-when-using-Web-Contents-with/m-p/4771359#M153237</guid>
      <dc:creator>AlexR_DE</dc:creator>
      <dc:date>2025-07-21T19:34:01Z</dc:date>
    </item>
    <item>
      <title>Re: Sharepoint Authentication fails when using Web.Contents with RelativePath on files</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Sharepoint-Authentication-fails-when-using-Web-Contents-with/m-p/4771510#M153238</link>
      <description>&lt;P&gt;Have you tried &lt;A href="https://learn.microsoft.com/en-us/powerquery-m/sharepoint-files" target="_self"&gt;SharePoint.Files&lt;/A&gt;? Is there some hang-up with that?&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jul 2025 02:21:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Sharepoint-Authentication-fails-when-using-Web-Contents-with/m-p/4771510#M153238</guid>
      <dc:creator>MarkLaf</dc:creator>
      <dc:date>2025-07-22T02:21:04Z</dc:date>
    </item>
    <item>
      <title>Re: Sharepoint Authentication fails when using Web.Contents with RelativePath on files</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Sharepoint-Authentication-fails-when-using-Web-Contents-with/m-p/4771810#M153241</link>
      <description>&lt;P&gt;Of course I tried.&lt;/P&gt;&lt;P&gt;The issue is performance. I expect thousands of files and that simply takes to long to load all of them first and then do filtering.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jul 2025 07:20:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Sharepoint-Authentication-fails-when-using-Web-Contents-with/m-p/4771810#M153241</guid>
      <dc:creator>AlexR_DE</dc:creator>
      <dc:date>2025-07-22T07:20:39Z</dc:date>
    </item>
    <item>
      <title>Re: Sharepoint Authentication fails when using Web.Contents with RelativePath on files</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Sharepoint-Authentication-fails-when-using-Web-Contents-with/m-p/4773657#M153287</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1272812" data-lia-user-login="AlexR_DE" class="lia-mention lia-mention-user"&gt;AlexR_DE&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Thanks for the update. You're right when using SharePoint.Contents(), it only shows one folder level at a time. So, if you are working with a deep folder structure, it can get a bit tricky (and tedious) to navigate manually through each level.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;If your goal is to access a file based on a full path (especially when the path is stored in a column or might change), a better option would be to use the SharePoint.Files() connector instead. This connector pulls all files from the SharePoint site, including those in subfolders and gives you the full folder paths, which makes it much easier to filter dynamically.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Here’s a basic example:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;let
    siteUrl = "https://yourcompany.sharepoint.com/sites/yoursite",
    allFiles = SharePoint.Files(siteUrl, [ApiVersion = 15]),

 
    desiredPath = "https://yourcompany.sharepoint.com/sites/yoursite/Shared Documents/General/1_Workstreams/9_Rollout/excel_file.xlsx",

    file = Table.SelectRows(allFiles, each [Folder Path] &amp;amp; [Name] = desiredPath),


    output = Table.TransformColumns(file, {"Content", Excel.Workbook})
in
    output&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;This way, you don’t need to manually chain folder levels, and you can easily filter for specific files based on the full path either hardcoded or coming from a column.&lt;BR /&gt;&lt;BR /&gt;Hope this helps clarify things and let me know what you find after giving these steps a try happy to help you investigate this further.&lt;BR /&gt;&lt;BR /&gt;Thank you for using the Microsoft Community Forum.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jul 2025 12:07:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Sharepoint-Authentication-fails-when-using-Web-Contents-with/m-p/4773657#M153287</guid>
      <dc:creator>v-kpoloju-msft</dc:creator>
      <dc:date>2025-07-23T12:07:04Z</dc:date>
    </item>
    <item>
      <title>Re: Sharepoint Authentication fails when using Web.Contents with RelativePath on files</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Sharepoint-Authentication-fails-when-using-Web-Contents-with/m-p/4773915#M153298</link>
      <description>&lt;P&gt;But this is leading exactly to the initial problem again: I expect a huge number of files in the same Sharepoint. If the connector now pulls first all files (even if only the meta-datA) it takes ages to refresh only to filter down to a few afterwards?!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I need a away to pull individual files (for which I know the path though) AND extract the contents with working authentication...&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jul 2025 15:23:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Sharepoint-Authentication-fails-when-using-Web-Contents-with/m-p/4773915#M153298</guid>
      <dc:creator>AlexR_DE</dc:creator>
      <dc:date>2025-07-23T15:23:09Z</dc:date>
    </item>
    <item>
      <title>Re: Sharepoint Authentication fails when using Web.Contents with RelativePath on files</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Sharepoint-Authentication-fails-when-using-Web-Contents-with/m-p/4777733#M153438</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1272812" data-lia-user-login="AlexR_DE" class="lia-mention lia-mention-user"&gt;AlexR_DE&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Thank you for the follow-up and for clearly outlining the issue. You are right to be concerned about performance when dealing with a large number of files in a SharePoint document library.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;To avoid the performance overhead of scanning all files in the folder (as is the default&lt;BR /&gt;behaviour with SharePoint.Files), and since you already know the exact file path, you can directly access the file using either:&lt;BR /&gt;&lt;BR /&gt;Option1: SharePoint.Contents() with direct file targeting.&lt;BR /&gt;This method allows you to retrieve a specific file from the library without pulling metadata for all other files:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;let

    SiteURL = "https://yourtenant.sharepoint.com/sites/yoursite/",

    FilePath = "Shared Documents/FolderName/YourFile.xlsx",

    File = SharePoint.Contents(SiteURL){[Name="YourFile.xlsx", FolderPath=SiteURL &amp;amp; "Shared Documents/FolderName/"]}[Content],

    ExcelData = Excel.Workbook(File)

in

    ExcelData&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;Option2: Web.Contents() for direct file access.&lt;BR /&gt;Alternatively, use Web.Contents() if you have a static link to the file:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;let

    FileURL = "https://yourtenant.sharepoint.com/sites/yoursite/Shared%20Documents/FolderName/YourFile.xlsx",

    Source = Excel.Workbook(Web.Contents(FileURL))

in

    Source
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;Make sure that the authentication method in Data Source Settings is set to Organizational Account.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;If you are using Power BI Service, confirm that the SharePoint connector is configured using OAuth in the dataset settings, especially if the file is protected under Microsoft 365 authentication policies.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Hope this helps clarify things and let me know what you find after giving these steps a try happy to help you investigate this further.&lt;BR /&gt;&lt;BR /&gt;Thank you for using the Microsoft Community Forum.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jul 2025 04:06:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Sharepoint-Authentication-fails-when-using-Web-Contents-with/m-p/4777733#M153438</guid>
      <dc:creator>v-kpoloju-msft</dc:creator>
      <dc:date>2025-07-28T04:06:54Z</dc:date>
    </item>
  </channel>
</rss>

