Package your job and report model as a feature

This tutorial is part of a serie. It references the previous article called Create a custom timer job to gather data and generate report source files

This sample can be downloaded from the "Release" section (find the file).

I. Create a Feature to deploy your job

You need to add the job to the target SharePoint environment. You can use a feature receiver provided in the SPReporting Framework to make it easier.

Create a Feature.xml file to define your feature (you can create a folder called "Package" in your project directory to put all your deployment files) :

Package structure

Define a new Id, a Title and a Description, set the Scope to "Web" and Hidden to "TRUE" (it will be activated throught the Reports Center administration page to the Reports Center website) and specify the following Feature Receiver attributes :
  • ReceiverAssembly = "SharePointOfView.SPReporting, Version=, Culture=neutral, PublicKeyToken=85a56337686e234b"
  • ReceiverClass = "SharePointOfView.SPReporting.EventReceivers.JobInstallFeatureReceiver"

Then add the following properties that will be used to add the job and set a schedule :
  • IsSoVSPReportingFeature (= true) : needed to detect SPReporting Features
  • JobName : internal job's name, must be unique
  • JobDisplayName : job's display name
  • JobReportSource : report's filename generated in the reports document library
  • JobTypeName : your job's class fullname (namespace + class name)
  • JobAssemblyName : your full assembly name (be sure to reference the right version and PublicKeyToken)
  • JobScheduleType : could be "Daily", "Hourly" or "Minute". This is the schedule type
  • JobScheduleBegin : schedule's begin timespan
  • JobScheduleEnd : schedule's end timespan
  • JobScheduleInterval : schedule's interval (used only for "Minute" jobs)

Here is the Feature with all the properties set :


II. Package your development as a Solution

This a common step for any SharePoint projects, feel free to use some tools like WSPBuilder or your own scripts (write DDF, manifest.xml, run the makecab etc...).

In this solution, put :
  • your assembly (DeploymentTarget = GAC)
  • your feature

III. Deployment and activation

You can deploy your solution running these commands :
  • stsadm -o addsolution -filename MyReportSample.wsp
  • stsadm -o deploysolution -name MyReportSample.wsp -allowGacDeployment -immediate

You can check if the deployment has been successfull on the "Solution management" page (Central Administration > Operations > Global Configuration).

Then go to the "Reports Center Administration" (Central Administration > Operations > SharePoint Of View). The new feature should be displayed like this :

Reports Center Administration for activation

You can click on the "Activate" button. The job should be listed below (you may need to refresh the page).

Feature active and job added

Last edited Dec 28, 2008 at 10:52 PM by GatWeb, version 4


No comments yet.