SOLVED

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?

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

 

https://learn.microsoft.com/en-us/azure/active-directory/enterprise-users/groups-lifecycle

@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)
Solution
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:
https://learn.microsoft.com/en-us/graph/api/site-list?view=graph-rest-1.0&tabs=http

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
https://blog.darrenjrobinson.com/getting-microsoft-365-individual-user-usage-reports-with-powershell...

@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 https://admin.microsoft.com/Adminportal/Home?#/reportsUsage/SharePointSiteUsageV1 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.

Hi @NicolasKheirallah  @Russ Thomson,

I just read this post as I am looking for the best way to clean up over 600 SharePoint sites :face_with_rolling_eyes:

This is very helpful but it was posted last year so curious if Russ found a better solution than your last post?  I am not a global admin so I doubt I can do anything in Azure.

Did you consider the activity of M365 group emails associated with your sites?  If so, how did you pull that info into your list?  I know when a user creates a Team that it automatically creates the whole package including a group email.  This goes for Planner as well.  I've been afraid to delete sites until I know that those emails and everything within that package is also inactive.  When you ask the system if a site is inactive, is it looking at ALL of that?     

Can you give me more details of the use-case and I'll give you the best approch for you :) Do you want to delete them ? Backup or archive them ? Save any data in any sense etc?


As for M365 group mail, those are so extremtly rarely used so I just script the Email titles out and see if there's anything of importants but 99.8% of groups never use that feature as users don't know about it
Thanks for the quick response!
I'm glad to hear you say that about the email groups because that's exactly what I've been thinking. I would even say about 75% of the site owners aren't aware of how many sites they have.

I am the first SharePoint Admin assigned this role for our company. We don't have any policies in place for data governance so I'm just trying to start somewhere. I would imagine if a site consisted of any data worth keeping then we would want to archive it. However, I'm not sure what or where that would be stored either. Not sure if our license includes the M365 Archive or Backup. I would need to ask our global admin.

I will start with getting my list into SharePoint so I can see what I'm working with.
1 best response

Accepted Solutions
best response confirmed by Linus Cansby (MVP)
Solution
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:
https://learn.microsoft.com/en-us/graph/api/site-list?view=graph-rest-1.0&tabs=http

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
https://blog.darrenjrobinson.com/getting-microsoft-365-individual-user-usage-reports-with-powershell...

View solution in original post