How to implement custom User Profile handler?

    1: namespace MyNewProfileHandler
    2: {
    3: public class MyUserProfileHandler : MySiteProfileHandler 
    4: {
    5: public override void SetMySiteOwner(Microsoft.Office.Server.ServerContext context, UserProfile profile, string newOwner)
    6: { 
    7: base.SetMySiteOwner(context, profile, newOwner);
    8: } 
    9:  
   10: public override bool PreProfileDeleted(Microsoft.Office.Server.ServerContext context, UserProfile profile)
   11: { 
   12: return base.PreProfileDeleted(context, profile);
   13: } 
   14: }
   15: }
   16:  

Installation steps:

1) Strong name this assembly and register it to GAC

2) Run the stsadm tool  with the below command and parameter

stsadm -o profiledeletehandler -type "MyNewProfileHandler.MyUserProfileHandler, MyNewProfileHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6dc6c93b86ce3656"

3) Reset the timer services

 

How to test this custom handler?

1) Do a full user profile import through SSP

2) Delete a user from Active Directory

3) Do an incremental import, you could see the custom handler gets called.

 

Enjoy...