Recently, I came across a requirement where I needed the deleted event receiver on managed metadata service. I initially thought there may definitely be some direct solution for this kind of requirement but unfortunately, no synchronous event receiver is available which triggers immediately after the term has got deleted from the termset.
After some research, I came across a method ‘GetChanges’ which is available at TermStore and TermSet both.
This solution worked well and I created a PowerShell script which checks TermStore for any deleted terms after a specific interval that can be configured in the task scheduler.
What I wanted to achieve is to set the term ‘Uncategorized’ to the list item whose original term had got deleted.
You can read the method documentation at TermSet.GetChanges Method
Solution for SharePoint 2013
- $dt = Get-Date;
- $dt = $dt.AddDays(-1);
- $url = $webAppURL;
- $tax = Get-SPTaxonomySession -Site $url;
- $termStore = $tax.TermStores[0];
- $deletedTerms = $termStore.GetChanges($dt, [Microsoft.SharePoint.Taxonomy.ChangedItemType]::Term,[Microsoft.SharePoint.Taxonomy.ChangedOperationType]::Delete);
In the above example, I was looking for deleted terms in the previous number of days (past 1 day in above example).
There are four overloads available for the GetChanges method. The one I used has the following parameters,
- startTime of type DateTime (A UTC time indicating the earliest change to be included in the result collection)
- itemType of type ChangedItemType (Indicates the type of ChangedItem objects to return) Following are the possible values of Enum.

- operationType of type ChangedOperationType (Indicates the types of operations to return)
Following are the possible values of Enum.


Join the conversation! Your thoughts help the community grow.