none
Error when registering Timer Job SPJobDefinition.Update - URGENT

    Question

  • I am trying to register my custom timer definition through object model code. i created a layout application and it has an aspx page to register the timer job. i am able to access my sharepoint object model objects but when method of Update is called i get the following exception

     

    System.Security.SecurityException: Access denied. at Microsoft.SharePoint.Administration.SPPersistedObject.Update() at Microsoft.SharePoint.Administration.SPJobDefinition.Update() at CustomTimerDefinition.MainCallToRegisterTimerJob() The Zone of the assembly that failed was: MyComputer

     

     

    my code is

     

    Dim oTimerJob As New CustomTimerDefinition("MyCustomTimer", oSite.WebApplication)

    'Every 5 minute

    Dim oSchedule As New SPMinuteSchedule()

    oSchedule.BeginSecond = 0

    oSchedule.EndSecond = 59

    oSchedule.Interval = 7 'minutes

    oTimerJob.Schedule = oSchedule

    oTimerJob.Update()    

     

    my CustomTimerDefinition is a class inheriting from SPJOBDefinition class and it is a GAC component. i know a way to register timer through Feature but i want to do it through object model where i also want to keep it in Layout application.

     

    any help on it?

     

     

    Friday, February 15, 2008 7:42 PM

Answers

All replies