5

Spawned from this question.

I have been able to add a new link to my Central admin page under the Monitoring->Timer Jobs section. My problem is that I have been unable to figure out how to add it to the administration page for a specific timer job. Below is what I have:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction Id="21EC2020-3AEA-1069-A2DD-08002B30309D" GroupId="TimerJobs"
      Location="Microsoft.SharePoint.Administration.Monitoring"
      Sequence="10"
      Title="Social Admin Logging" Description="">
    <UrlAction Url="_admin/SocialAdmin.aspx" />
  </CustomAction>
</Elements>

Does anyone know how I could go a few levels deeper to get to a specific timer job admin page? I made a half baked attempt by changing the location to something like: Microsoft.SharePoint.Administration.Monitoring.Review Job definitions.MyJobName but that didn't work

1 Answer 1

2
+50

There's no Ribbon in the Timer Job config area, so that's not an option.

Also, you can't add any custom actions to JobEdit.aspx easily either, so that's out the question, too.

What I would do (and have done before), is add your custom action to the place you already can do, and in your config page have a dropdown box that populates with all instances of your Job, and an OK button to select that job.

On postback of that OK button, you populate a form to configure the job (I used the Properties property bag to store all config settings, just easier that way), with OK/Cancel buttons to set the configuration or return to the previous page without commiting.

Freebie tip!

Also, to replicate the "Return to previous page" behaviour, you'll need to add the current page to the Custom Action's URL as a query string, and this is done with nasty looking javascript, like this:

<UrlAction Url="javascript:window.location= '{SiteUrl}/_admin/YOURTIMERJOB.aspx?Source=' + window.location" />

Then, in your config page, you read the Source param from the Query String, and use SPHttpUtility to redirect to that location, both upon Cancelling and Clicking OK (after you commit the changes).

3
  • you beat me to it. same as my approach :-D!
    – Colin
    Commented Jun 21, 2011 at 15:56
  • I hope it works well, I hashed out a whole bunch of code and a couple of pages but haven't had a chance to test it yet :P
    – James Love
    Commented Jun 21, 2011 at 15:59
  • I grouped all my custom timerjob settings (schedule + needed proeprties) on a page deployed under a custom group in the central admin's web app settings group. This way the customer can do all changes from 1 group per timerjob
    – Colin
    Commented Jun 21, 2011 at 16:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.