Managing Old/ Inactive SharePoint Sites

Brass Contributor

Where do you go to find information about managing old and inactive SharePoint sites? Like, a *lot* of sites, such that automation is required. My fantasy is that a Power Automate workflow could be built to crawl through each active site and look at the last active date, ping the owner if that date is far in the past, switch the site to read-only if there's no response, and then delete it if nobody screams about that, but before I attempt going down that road - if it's even possible - I wanted to ask how other folks manage large amounts of inactive sites? As far as I can tell, the SP policies aren't useful in this case. 

Bonus question: we have sites with last active dates going back to 2016, but then a whole bunch which don't have a last active date at all - what's going on there?

4 Replies

@Russ Thomson 

Quick reply, I can go much more in detail if needed, I can talk governance for weeks :lol:


So your not far off how you should build a native Governance engine within Microsoft 365/SharePoint.


First off, what you need to do:
You need to script or use Power Automate to get all inactive sites, ownerless sites and groups that are not been used for atleast a year. You can use the graph connector or HTTP connector for this and register an app to get all permissions needed


Inventory these to a SharePoint list and ask the owners or the members if the sites still needs to live and the content? If no delete the site or archive it. If yes, keep it but they need to be owners, You need atleast two owners for all sites.

Send out an email with a couple of options and let the user decide, Keep, Archive or Delete. These will be tagged in the response.

Sites that need be archived you have two ways. Save everything to a library for each site OR Use Syntex and they archiving solution, it's alot cheaper storage and you can save the whole site.  I prefer the Syntex one but it's not out yet.


Also make use of sensitivity labels and retention policies to know what kind of data we have, It's A to Ö as we say in Sweden :lol:

When you're done:
So in Azure you have the option for expiration policy, this will notify the owner if the site/ has been inactive for a year if it going to be deleted. You can use the Graph API to trigger from this and archive the content of the site. For this you can use a flow that checks everyday and then decide what to do.

@NicolasKheirallah thanks - this is a really helpful response. I tried building a Power Automate as you suggested, but the example I followed only includes the Title and SiteUrl properties - I wonder where I locate the correct terms for e.g. Last Activity. Also, I noticed that when I ran a test, only about 10% of our total sites were returned (and - incidentally - multiple line items per site): is this perhaps related to what you mean by "register an app to get all permissions needed"?


Send HTTP Request.png

best response confirmed by Linus Cansby (MVP)
Yeah the Do_not_delete_SP_list isn't the best option. I wouldn't recommend it. Do you want to trigger on each new site create or get all sites?

So there's three ways of doing it :

1. You can also use Powershell as this should be a one time operations (?)
Code snippet can be found here:

2. So you can register an app in Azure and assign in SharePoint permissions, then you can query it and get all sites.

3. Office 365 Usage Reports
Not my blog but it should explain it :) Here you get a detailed view of all sites and their usage but there is a 48 hours delay

@NicolasKheirallah thanks again. I appreciate these answers, but unfortunately they're a little above my skill level. As an alternative, I exported a complete list of sites from and imported that into a SharePoint list, for which I can build a Power Automate workflow to send owner notifications.

I'll have to give this some more thought though - and the deletion stage too (I'm not even sure if my "set site to read only" idea can be done) - because there are several thousand sites going back 8 years, which means there's all sorts of considerations around e.g. sites without owners and managing different site types, and there isn't much documentation around using the Send an HTTP request in SharePoint action to delete sites either. Thanks again for your help.