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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
regerror6
Frequent Visitor

How to exclude deleted SharePoint files

My data source is a SharePoint online library, and I am trying to figure out how to exclude deleted SharePoint files from the result set?  Here is an example source step:

 

= SharePoint.Files("https://examplecompany.sharepoint.com/sites/examplesite/", [ApiVersion = 15])

 

In other posts, the recommendation is to delete it from the SharePoint recycle bin (both first and second stage).  I deleted it from the first stage recycle bin, but I am not a site collection administrator to delete it from the second stage.  Plus, I do not think the library owners will remember to do this anyway (why should they?).  I am surprised a delete indicator is not included in the metadata.

 

On a weird note, it looks like Power Query is excluding it from the preview, but the deleted file reappears once it is applied to the report.

 

Has anyone found a way to achieve this?

1 ACCEPTED SOLUTION

It looks like this might have been a timing issue.  I refreshed the report while I was on the phone with MSFT (first time since yesterday), and the deleted file was gone.  I am not able to see the site collection (second stage) recycle bin, so I cannot see if it has also been purged from the site, too.  My understanding contents are automatically removed after 93 days unless someone manually removes them.  MSFT did not have any other insight, but I'll consider this resolved for now.

 

If anyone has any other scenarios, let me know.  I am curious if other folks have issues with this.

View solution in original post

3 REPLIES 3
lbendlin
Super User
Super User

Interesting observation. The same happens for SharePoint.Contents() .  Value.Metadata also doesn't seem to yield anything. You can raise an issue at https://issues.powerbi.com . If you have a Pro license you can consider raising a Pro ticket at https://powerbi.microsoft.com/en-us/support/pro/

Thanks for confirming the behavior, lbendlin!  I submitted a Pro ticket and will update this post if MSFT is able to provide any insight.

It looks like this might have been a timing issue.  I refreshed the report while I was on the phone with MSFT (first time since yesterday), and the deleted file was gone.  I am not able to see the site collection (second stage) recycle bin, so I cannot see if it has also been purged from the site, too.  My understanding contents are automatically removed after 93 days unless someone manually removes them.  MSFT did not have any other insight, but I'll consider this resolved for now.

 

If anyone has any other scenarios, let me know.  I am curious if other folks have issues with this.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.