Power Query SharePoint.Files() works but SharePoint.Contents() can't authenticate...

Pearce, Brent 1 Reputation point
2022-03-12T19:12:51.327+00:00

Recently migrated hundreds of Windows shares to SharePoint Online. This forced us to modify any processes that used Power Query to read data from Windows to now read data from SharePoint. Most of the time this was easy to accomplish - however - there are some SharePoint sites that we are struggling with. Imagine if you created a new query to read files from a SharePoint folder. When building this via the Power Query GUI, the underlying formula used is SharePoint.Files(). While this works for sites with a few hundred files, performance drops dramatically/exponentially for sites with more than a few hundred files. Fortunately the function SharePoint.Contents() performs much better and is almost interchangeable with SharePoint.Files() - even the function's parameters are the same. So typically we use the GUI to build the initial query, then change SharePoint.Files() to SharePoint.Contents(). Problem is that for about 10% of the sites we get an authentication error when we switch to SharePoint.Contents(). We can't seem to get past the error. If we change it back to SharePoint.Files() it authenticates just fine - but performs poorly for large sites. Again, we make no changes to the parameters for these functions. Anyone else experience this behavior? Any guidance would be greatly appreciated.

Microsoft 365 and Office | SharePoint | For business | Windows
Community Center | Not monitored
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. JoyZ 18,111 Reputation points
    2022-03-14T05:47:44.82+00:00

    @Pearce, Brent ,

    Power Query is currently not supported in Microsoft Q&A.

    You can post your question in Microsoft Power Query Community. The experts there will be willing to provide decent help for your question.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


    0 comments No comments

  2. Pearce, Brent 1 Reputation point
    2022-03-15T05:08:37.08+00:00

    I apologize for misfiling. No idea how I got to the Q&A forum...

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.