Friday, February 15, 2008 7:42 PM
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
oSchedule.BeginSecond = 0
oSchedule.EndSecond = 59
oSchedule.Interval = 7'minutes
oTimerJob.Schedule = oSchedule
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?
Sunday, February 17, 2008 11:27 PM
Personally I have only ever registered timer jobs through features, but......
the above sounds like it could be to do with the privelages required to register a timer job.
Have you tried impersonating an admin user or elevating privelages.
Monday, February 18, 2008 11:17 PMThis problem is vaguely similar to an issue I had with BDC that I wrote about here:
It's not apples to apples, but might give you a lead.
--Paul Galvin, Conchango
RSS @ http://feeds.feedburner.com/PaulGalvinsSharepointSpace
Web site @ http://paulgalvin.spaces.live.com
Tuesday, April 01, 2008 4:17 AM
Recently i switched back to this task and found that if you login on your sharepoint server desktop using Server FARM Admin account and activate the feature to register timer job through Command line stsadm command. it get register right away without any issue. Above error occur if you are not logged in on sharepoint server desktop with farm admin. I tried with farm admin account from a different machine but it keep failing but when i used stsadm on sharepoint server with farm admin account login, it works perfectly.