Question

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

Was it helpful?

Solution

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).

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top