Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
TotalAnonymous
Helper III
Helper III

SharePoint.Contents - Expression Error - Policy & Templates Folder Missing

Dear Community,
I hope you're doing well. I have a question regarding SharePoint Contents expression.

 

Somehow, we're experiencing an error today.


This kind of error tell us that the "Policies and Template" does not exist in the SharePoint.

TotalAnonymous_0-1766454501570.png


I've checked in the preview that the Policies and Template folder does not exist.

TotalAnonymous_1-1766454519542.png

 

This is my current M Code. As you can see, before the error today, the refresh process ran smoothly. When I develop the transformation step, The Policies and Templates folder still does exist in the Power Query preview and yesterday.

TotalAnonymous_2-1766454539504.png

 

 

This is a snapshot of targeted folder in the current SharePoint. As you can see, I still can access the path from my end. Therefore, I think that maybe the access issue is not a root cause of this issue.

TotalAnonymous_3-1766454539506.png

 


May I know if you have experienced the same like this? If so, could you please suggest me what's the root cause? Actually, I'm thinking to change the SharePoint Contents expression into SharePoint Files expression. However, I don't want to that because It will make the my refresh time slower.

 

Really appreciate your advice on this.
Thank you!

1 ACCEPTED SOLUTION

Hi @TotalAnonymous 


When you explain the issue, it’s important to clarify that Power BI does not use the SharePoint UI or navigation menu to find files. The SharePoint.Contents connector only accesses locations that exist as actual document libraries or folders in SharePoint's metadata.

 

Although the “Policies & Templates” link is visible in the SharePoint UI, it is not currently set up as a physical library or folder in the site's metadata. This is why Power BI cannot access it.

 

It may help to ask your SharePoint Administrator to check where these files are stored and confirm if “Policies & Templates” is a real document library or simply a navigation link, custom view, or shortcut. If needed, they can update SharePoint so that this location is a standard document library or folder. Once it is set up this way, SharePoint.Contents will be able to access it properly.

Regards,

Microsoft Fabric Community Support Team.

 

View solution in original post

9 REPLIES 9
v-karpurapud
Community Support
Community Support

Hi @TotalAnonymous 

We have not received a response from you regarding the query and were following up to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions.

 

Thank You.

v-karpurapud
Community Support
Community Support

Hi @TotalAnonymous 

I wanted to check if you’ve had a chance to review the information provided. If you have any further questions, please let us know. Has your issue been resolved? If not, please share more details so we can assist you further.

Thank You.

v-karpurapud
Community Support
Community Support

Hi @TotalAnonymous 
Thank you for contacting the Microsoft Fabric community forum.

 

The issue isn't related to access changes or the folder being deleted. The error occurs because the query tries to select a row that doesn't exist at the referenced level in SharePoint.Contents.

 

In SharePoint Online, “Policies & Templates” is a folder inside the “Shared Documents” library, not a toplevel node. SharePoint.Contents returns the hierarchy as it exists in SharePoint. If the lookup is done at the wrong level (for example, at the site root instead of within the library), Power Query returns: Expression.Error: The key didn’t match any rows in the table.

 

Also, SharePoint.Contents requires an exact match on the Name column, including special characters like &. If the M code uses "Policies and Templates" or searches at the wrong level, the lookup will fail, even if the folder is visible in SharePoint.

 

To resolve this, update the M code to use explicit table filtering on SharePoint.Contents instead of direct row navigation.

let

   Source = SharePoint.Contents(

       " https://xxx.sharepoint.com/sites/xxxx",

       [ApiVersion = 15]

   ),

   SharedDocuments =

       Source{[Name = "Shared Documents", ItemKind = "DocumentLibrary"]}[Content],

   PoliciesAndTemplates =

       SharedDocuments{[Name = "Policies & Templates", ItemKind = "Folder"]}[Content],

   Marketing =

       PoliciesAndTemplates{[Name = "Marketing", ItemKind = "Folder"]}[Content],

   CoreOfTheCore =

       Marketing{[Name = "Core of the Core", ItemKind = "Folder"]}[Content]

in

   CoreOfTheCore


After updating the query to use table filtering, the refresh should work properly without needing to switch to SharePoint.Files.

 

I hope this information is helpful. If you have any further questions, please let us know. we can assist you further.

Best Regards.
Microsoft Fabric Community Support Team.
 

Hi @v-karpurapud , I'm sorry I just reply this post due to the holiday. 

Thank you for your help for this one! Really need your assist further 🙂

I'm facing this one

TotalAnonymous_0-1767659503846.png

On top of that, 

I can't find Policies and Templates inside of "Shared Documents"

TotalAnonymous_1-1767659719620.png


FYI, the current Policies and Templates is somehow on the top of hierarchy but as you can see in the above screenshot, I can't find Policies and Templates

TotalAnonymous_2-1767660333273.png

 




Before this issue happened, My M Code works properly. Thank you!

Hi @TotalAnonymous 


This error happens because the path specified in your M code no longer matches the current hierarchy provided by SharePoint.Contents, which only lists actual document libraries and folders.

If a folder or library is renamed, moved, or its structure changes in SharePoint, SharePoint.Contents won’t find the expected row, leading Power Query to show the error “The key didn’t match any rows in the table.”


In your situation, “Policies & Templates” is no longer available at the expected location in the metadata, even if it still appears in the SharePoint UI. The UI may display navigation items that don’t always match the physical storage structure.
This is a result of a mismatch between the UI and the metadata, not a permissions or deletion issue.

To resolve this, review the Source step in Power Query and check which containers SharePoint.Contents currently lists. Update your navigation path by choosing the correct folder or library based on the latest metadata. Once your query matches the current hierarchy, the refresh should work without needing to change to SharePoint.Files.

If you have any more questions, please let us know and we’ll be happy to help.

Regards,

Microsoft Fabric Community Support Team.

 

Hi @v-karpurapud ,

Thanks for your help!

Regarding the "Containers", do you mean that I need to check each of ten items as shown in the picture below?

TotalAnonymous_0-1767679341353.png


If I can't find it, does it mean there's nothing that I can do in the Power BI side?

I have checked each of those 10 items, most items that I found has aspx. extension instead of xlsx or the expected file/folder.

Thank you!

Hi @TotalAnonymous 


Since you have already reviewed all the containers at the Source step and “Policies & Templates” does not show up as a document library or a physical folder, this confirms that the location is not available via SharePoint.Contents metadata.


In this case, the suggested solution from Power BI is to use SharePoint.Files, which accesses files by their actual file paths and does not rely on container metadata or UI navigation.

 

If you need to keep using SharePoint.Contents, please reach out to your SharePoint administrator to verify the physical storage of the files and check if the SharePoint setup can be changed to make them accessible as a document library or folder.

Regards,

Microsoft Fabric Community Support Team.

Hi @v-karpurapud , 

Thank you for your explanation!

Since I don't want to use Sharepoint.Files due to the slow refresh time, I will keep using Sharepoint.Contents. 

Hence, based on your suggestion, I need to reach out to SharePoint Administrator and check if "Policies and Templates" folder can be changed to be accessible as a document library or folder. 

However, do you know how to explain it clearly to SharePoint Administrator? Because I think he/she will refer to the UI version not the metadata. 

Thank you!

Hi @TotalAnonymous 


When you explain the issue, it’s important to clarify that Power BI does not use the SharePoint UI or navigation menu to find files. The SharePoint.Contents connector only accesses locations that exist as actual document libraries or folders in SharePoint's metadata.

 

Although the “Policies & Templates” link is visible in the SharePoint UI, it is not currently set up as a physical library or folder in the site's metadata. This is why Power BI cannot access it.

 

It may help to ask your SharePoint Administrator to check where these files are stored and confirm if “Policies & Templates” is a real document library or simply a navigation link, custom view, or shortcut. If needed, they can update SharePoint so that this location is a standard document library or folder. Once it is set up this way, SharePoint.Contents will be able to access it properly.

Regards,

Microsoft Fabric Community Support Team.

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors