Guest User

Untitled

a guest
Jul 18th, 2012
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. Timer job not listed in Timer Job Definitions Sharepoint 2007
  2. public override void FeatureActivated(SPFeatureReceiverProperties properties)
  3. {
  4. try
  5. {
  6. SPSecurity.RunWithElevatedPrivileges(delegate()
  7. {
  8. SPWeb parentWeb = properties.Feature.Parent as SPWeb;
  9. UpdateEmpReferralListTimer taskJob;
  10. SPMinuteSchedule schedule;
  11. foreach (SPJobDefinition job in parentWeb.Site.WebApplication.JobDefinitions)
  12. {
  13.  
  14. if (job.Name == "xyz")
  15. job.Delete();
  16. }
  17. parentWeb = properties.Feature.Parent as SPWeb;
  18. taskJob = new UpdateEmpReferralListTimer("xyz", parentWeb.Site.WebApplication);
  19. schedule = new SPMinuteSchedule();
  20. schedule.BeginSecond = 0;
  21. schedule.EndSecond = 59;
  22. taskJob.Schedule = schedule;
  23. taskJob.Update();
  24.  
  25. });
  26. }
  27. catch (Exception Ex)
  28. {
  29. string str = Ex.Message.ToString();
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment