Sladescross's Blog

Blogging about Sharepoint related stuff

Service Timer Job March 21, 2013

Filed under: Lock,Service,Timer Job — sladescross @ 9:08 pm

Table 2. SPJobLockType values

Value Description
None Locking is disabled. Job runs on all servers in the farm unless you pass an SPServer object for the server parameter.
ContentDatabase Job runs for each content database associated with the job’s web application.
Job Only one server can run the job at a time.

After you create the constructors, you must override the Execute method of the SPJobDefinition class and replace the code in that method with the code that your job requires. If your code can run without further configuration, you are finished creating this class. Otherwise, you must add configuration screens and classes to your project, as shown in the next section. The next section also discusses the actual code from the sample that belongs in the Execute method.


Delete Timer Job January 5, 2011

Filed under: Delete Timer Job,Timer Job,Timer Job Delete — sladescross @ 9:54 pm


Enumerate SSP Timer Jobs September 14, 2010

Filed under: Enumerate,Timer Job — sladescross @ 9:20 am

stsadm –o enumssptimerjobs –title “nameofssp”


Deploying Files Without WSP Directions June 26, 2010

Filed under: Deployment,Timer Job,WSP — sladescross @ 5:01 pm

Timer job to deploy files.


Creating Sharepoint Timer Jobs November 8, 2009

Filed under: Sharepoint,Timer,Timer Job — sladescross @ 11:15 am

A few weeks back I posted about how you can create custom timer jobs for use in the latest release of SharePoint to perform scheduled tasks. However, considering there have been almost 40 comments to the post in the last three weeks, I figured the post needed some clarification (duh, ya think?).

The first thing you need to do is create a class that inherits from the Microsoft.SharePoint.Administration.SPJobDefinition class. To implement this class, you need to create a few constructors and override the Execute() method, like so:

Powershell reporting and invoking of custom job definition.

Custom timer job and timer job configuration.

To read the data, use the XmlSerializer class to deserialize the XML into the Address object.

Address _address = new Address();
XmlSerializer serializer = new XmlSerializer(typeof(Address));
FileStream file = new FileStream(@"c:\address.xml", FileMode.Open);
_address = serializer.Deserialize(file) as Address;

To serialize the Address object back to the XML file, do the exact opposite of reading the file.

Address _address = new Address();
XmlSerializer serializer = new XmlSerializer(typeof(Address));
TextWriter writer = new StreamWriter(@"c:\address.xml");
serializer.Serialize(writer, _address);

The SPPersistedObject class provides a base class for all administration objects. It serializes all fields marked with the Persisted attribute to XML and writes the XML blob to the configuration database. The SPPersistedObject class contains code to serialize all its members that are base types, other persisted objects, and collections of persisted objects. Configuration data that is stored in persisted objects is automatically made available to every process on every server in the farm.



Get every new post delivered to your Inbox.

Join 63 other followers