Before starting of reading this,its best to know how to identify the inactive site ? There is couple of properties available for SPSite class.
using (SPSite site = new SPSite(SPContext.Current.Site.Url))
{
DateTime lastContentModified = site.LastContentModifiedDate;
DateTime lastSecurityModified = site.LastSecurityModifiedDate;
}
So you can decide to keep the inactive site in the server or not based on the number of days.
Unused site collection in SharePoint 2013 can be deleted from the server to free up some resources.
- LastContentModifiedDate
- LastSecurityModifiedDate
using (SPSite site = new SPSite(SPContext.Current.Site.Url))
{
DateTime lastContentModified = site.LastContentModifiedDate;
DateTime lastSecurityModified = site.LastSecurityModifiedDate;
}
So you can decide to keep the inactive site in the server or not based on the number of days.
Unused site collection in SharePoint 2013 can be deleted from the server to free up some resources.
Before deleting the unused site collection, farm admin need
to configure the outgoing email setting for sending the email notification to Site Owner. [Note: - Not Site collection
administrator]
See the difference between Site Collection Administrator Vs
Site Owner.
Farm admin can define to delete the SC then he need to
determine what will be the waiting period for site collection to be declared as
inactive.
He can schedule the email notification to SCA at daily,
weekly and monthly intervals.
SharePoint 2013 restricts the number of email notices to be
sent to site owners. Below table depicts the limitation on number of emails can
be sent on chosen interval.
Interval
|
Min
|
Max
|
Daily
|
28
|
164
|
Weekly
|
4
|
24
|
Monthly
|
2
|
6
|
The email will contain the link to capture the site owner
acknowledgment over his/her site status. If site owner does not respond to the
email notification on specified duration then site will be deleted
automatically. This feature must be turned on by the member of farm
administrator group.
If site collection configured to delete automatically, it’s
advisable to have site backup before site being deleted by the timer job.
If Site Owner specified the secondary site owner while
creating the site then secondary site owner also will receive the email notices
about the site deletion.
Site collection can be
deleted by giving intimation of 30 days duration as minimum and maximum 365
days.
CAàClick
on Application Management header linkà under site collection à
Site Use Confirmation and Deletion.
Screen looks like this.
Screen looks like this.
Another way is to delete the site create the site policy as seen in this post