Install Solution

Install Solution

The deployment of a WSS solution to a front-end Web server or an application server is performed in two phases

1. Add wsp to Solution Store
The solution store is part of the configuration database and stores the
various .wsp files
2. Deploy Solution
Solution can be deployed to one or more WSS Web Server/Application Server

stsadm -o addsolution -filename MKSTest.wsp
stsadm.exe -o execadmsvcjobs

stsadm -o deploysolution -name MKSTest.wsp -url http://xyz.com
Note : Targeting one site collection
stsadm -o deploysolution -name MKSTest.wsp -immediate -allcontenturls -allowGacDeployment -allowCasPolicies
Note: Push  solution to every site collection available within the server farm

stsadm.exe -o execadmsvcjobs
stsadm -o installfeature -name MKSTestFeature  -force
stsadm -o activatefeature -name MKSTestFeature  -force -url http://localhost

Uninstall Solution

stsadm -o uninstallfeature -name MKSTestFeature  -force
stsadm -o deactivatefeature -name MKSTestFeature  -force -url http://localhost
stsadm -o retractsolution -name MKSTest.wsp -immediate -allcontenturls
stsadm.exe -o execadmsvcjobs
stsadm -o deletesolution -name MKSTest.wsp -override

Advertisements

MOSS 2007 Timer Jobs

SharePoint Timer service is similar to Windows Task or Windows Services.
Time job inherits from

Microsoft.SharePoint.Administration.SPJobDefinition

using System;
using System.Net;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;

namespace MKS.Demo {
  public class TestTimerJobs : SPJobDefinition {

    public TestTimerJobs() : base() { }

    public TestTimerJobs(SPWebApplication webApp)
      : base(Globals.JobName, webApp, null, SPJobLockType.ContentDatabase) {
      this.Title = Globals.JobName;
    }

public TestTimerJobs(string TimerName , SPWebApplication webApp)
      : base(TimerName , webApp, null, SPJobLockType.ContentDatabase) {
      this.Title = TimerName ;
    }

  }
}

There are three different types of locking,

  • SPJobLockType.ContentDatabase Locks the content database associated with the job.
  • SPJobLockType.Job Locks the job to prevent multiple instances of the job from running on a single server.
  • SPJobLockType.None No locking.

Override the Execute virtual method defined in the SPJobDefinition.

public override void Execute (Guid targetInstanceId)
{
//Write your custom Logic here.
}

Compile the DLL and place it into GAC.

Deploymet


    // Get the object of TestTimerJobs what is deployed in GAC
    TestTimerJobs taskLoggerJob = new TestTimerJobs("TEST TIMER JOB", site.WebApplication);
    SPMinuteSchedule schedule = new SPMinuteSchedule();
    schedule.BeginSecond = 0;
    schedule.EndSecond = 59;
    schedule.Interval = 5;
    TestTimerJobs.Schedule = schedule;
    //update the job
   TestTimerJobs.Update();
BeginSecond and EndSecond specify that timer job can start
randomly in between.

Interval is a 32-bit integer that specifies the interval in minutes. The default value is 5.