I am investigating the below code to make sure if its quality is as per Microsoft standards. Actually Comments came from Microsoft code reviewer that we need to create new SPSite Object within the elevated code in delegate. //ExtranetManager is my custom class
I Investigated and have tried to fix but i don't believe that anything wrong with this code. I want to take help from experts in this forum if any body can give good comment about that code or if there is something wrong within elevated privileges. Any comment can help me that may be i am missing.
public class MyTimerJob : SPJobDefinition
{
public override void Execute(Guid targetInstanceId)
{
SPWebApplication wa = null;
wa = (SPWebApplication)base.Parent;
SPSecurity.RunWithElevatedPrivileges(delegate
{
ExtranetManager extranetManager =
new ExtranetManager(wa);
extranetManager.StartSynchronization();
});
}
}