In this article we will discuss about my site deletion email message which user gets when their subordinate’s my sites is scheduled for deletion.
My site deletion task is taken care by ‘my site cleanup timer job’. it is responsible to delete my site which are scheduled to deletion. In this article we will discuss how the timer job works and what it does.
What is the my site cleanup timer job?
The My site cleanup timer job is responsible for user profiles and my site of those users. this includes following activities:
- Remove the user profiles which are queued for deletion
- If those users have my site then user’s manager added as secondary site owner. An email triggers to user’s manager that my site will be deleted in 14 days.
- After 11 days of first notification, again email triggers to user’s manager that my site will be deleted in 3 days.
- After a period of 14days it deletes the my site
first thing we need to understand how the my site actually deleted
How is a user profile deleted in SharePoint?
There are couple of ways on how user’s profile deleted in SharePoint
- A user profile deleted when we delete it from the “Manage user profiles” section in Central Admin.
- When a user account which was included in previous profile import is no longer included in the next time.
suppose you delete a user account in Active Directory and then incremental or full user profile synchronization. You would expect that this means the user profile deleted, and in fact this is picked up as a delete from Active Directory and processed in the FIM, where SharePoint picks up the fact the user profile is deleted and deletes it.
What happens when the “My site Cleanup Timer job “runs?
- When user leaves the organization or terminated then his account get deleted/disabled in Active directory
- Once the user’s account is deleted/disabled and SharePoint get to know about this, the my site deletion times job will be triggered in that user’s account
- It first remove the user profile from the SharePoint and once the profile removed the user will no longer access to the SharePoint sites and it’s quite obvious that user will not be able to access any resource as account is already disabled/deleted in Active Directory.
- Once the deletion part done then access delegation part of the user’s “my site” takes place. Now timer job looks for the user’s manager and will assign the manager’s account as the secondary owner for the user’s “My site”. This process will send and email to the user’s manager letting him know about his subordinate’s “My site” and will also have a link to the user’s “My site”.
- This would give complete access to the manager of user’s “my site” including My Documents folder.
- Suppose if the user doesn’t have a “manager” mentioned in his SharePoint profile then timer job will look for the Secondary owner of the user’s “My site”. if it finds a secondary contact it will then make secondary contact as the secondary owner of the “My site” and will send an email to the secondary owner.
- The email will be sent in three parts,
- The first one will be a notification of the user’s “My site” with a link to the user’s “My site”
- Second one will be the sent exactly 11 days after that and this will give a reminder to manager about his subordinate’s “My site”.
- Finally the last one will be sent on the 14th day stating that user’s “My site” is deleted.
Note – it doesn’t mean timer job will run only when user’s account is deleted/disabled in Active Directory. Even if the user’s account is moved to different OU SharePoint will consider the fact that this account is no longer existing in the same OU as the profile synchronization connection is broken and will run the “My site” deletion timer job in the user’s account.
What happens when the user doesn’t have a manager?
|Manager Profile property populated||Secondary contact configured||Email sent||Site queued for deletion|
|Yes||Yes||Yes, to manager||Yes|
|Yes||No||Yes, to manager||Yes|
|No||Yes||Yes, to secondary contact||Yes|
Is it possible to customize the timer job?
Yes it is possible to customize timer job. You can change the schedule and you can plan your own cleanup process.
Issue with the “My site “deletion email message in SharePoint Server 2013:
When user Profile is deleted from My site, and email is sent to the user’s manager. However, this email contains a link to the user’s root My Site which no loner exists. In addition you receive the following error message
This issue has been addressed in the September 8, 2015 update: https://support.microsoft.com/en-us/topic/september-8-2015-update-for-sharepoint-server-2013-kb3085481-536d1260-08cb-6ff6-e937-715f3dd7276e
My site deletion email message in SharePoint Online:
When the OneDrive for Business account is scheduled for deletion, the default action to transfer ownership of the site to the manager of the user account that is being deleted. For this , the user profile Manager property must be set for the original owner of the OneDrive for Business site.
The access delegation setting is configured in the SharePoint admin center. This setting located in setup My site under user profile section. By default, Access Delegation is enabled. Sometime it is advised to configure secondary owner for site collection of user profile.
The profile and OneDrive cleanup process in SharePoint Online:
A work or school account is deleted from the Office 365 admin center or is removed through Active Directory synchronization.
- The account deletion is synchronized to SharePoint Online.
- The My site clean up timer job runs and marks user profile for deletion. the profile will be available in the database in a deleted state for 30 days. This coincides with the time that’s allocated to restore a deleted user account from the Azure Active Directory recycle bin.
- if the manager field populated for the deleted account, the manager will receive an email message that states that the site will be removed in 30days and that access to the site is granted to the manager.
- if the manager field doesn’t populate for the user account and secondary owner was configured in setup My site under the user profile section of the SharePoint admin center, the secondary owner contact will receive email message.
- Sevan days before the deletion date, second email will be sent to the manager or secondary owner as a reminder that OneDrive account in seven days.
- After seven days , the profile for the deleted account is deleted from the user profile service.
The OneDrive for business site for deleted account is sent to the site collection recycle bin. The site is deleted from the recycle bin where it kept for 93 days. During this time, users will no longer be able to access any shared content in the OneDrive. To restore OneDrive you need to user PowerShell. For info please visit my blog Restore OneDrive Deleted site