Forum Discussion
Managing Old/ Inactive SharePoint Sites
- Jun 05, 2023Yeah 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 - 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"?
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/
- Rebekah278May 01, 2024Copper Contributor
Hi NicolasKheirallah Russ Thomson,
I just read this post as I am looking for the best way to clean up over 600 SharePoint sites 🙄
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?
- May 01, 2024Can 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- Rebekah278May 01, 2024Copper ContributorThanks 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.
- Russ ThomsonJun 06, 2023Brass Contributor
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.