This error was resolved by setting "Include Nested Items" to "No". It seems when the library/list is large and limiting to folder is enabled with "included nested items" set to "yes" (default), the connector breaks with the unauthorized error. I assume this is a bug.
Logic App SharePoint Online Get Files Error Only When Limiting to Folder: Missing Authorization header for a privileged call on connection
I'm trying to use the Logic App SharePoint Online connector's "Get Files (properties only)" action. I have an account with full access to the SharePoint site connected. Then I set the "Site Address" and "Library Name" properly.
It works perfectly with this default setup: basically getting all files from the library works fine. I can also use the "Top Count" option, no problem.
But I want to use the "Limit Entries to Folder" filter to only get files from a specific folder in the library. As soon as I enable this and select the desired folder, the Logic App returns the following outputs in the body:
{
"@odata.nextLink": "https://logic-apis-centralus.azure-apim.net/apim/sharepointonline/xx_link_omitted_here",
"value": []
}
Upon opening the URL in the @odata.nextLink header, the following json is shown:
{
"Message": "Missing Authorization header for a privileged call on connection.",
"Source": "product policy"
}
Again, this only happens if I use the "limit to folder" option. I tried changing connection accounts, same result.
Then I tried this on other sites and libraries. Strangely, this does not happen to every SharePoint sites either, but it only happens to the two sites I actually need to run the Logic App against (both are fairly standard modern SP sites, with about 80k files each).
I've spent hours trying to make this work without success. Any advice would be greatly appreciated!