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
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
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.