Problems getting to work

Feb 13, 2009 at 12:39 PM
Hi,

I have installed your feature and can create timer jobs, but they do not seem to be doing anything.

Here is my code:

Imports Microsoft.SharePoint
Imports Microsoft.SharePoint.Utilities

 

 

Namespace TestTimerJobAssembly.TimerJobs
    
Public Class TimerJobClass
        
Dim site As SPSite
        
Dim web As SPWeb

 

 

        Public Sub TestTimerSchedule(ByVal strURL As String, ByVal webURL As String)
            site =
New SPSite(strURL)
            web = site.OpenWeb(webURL)
        
End Sub

 

 

        Public Sub Execute()
            SPUtility.SendEmail(web,
False, False, "<my email address>", "Test Timer Job", "It Worked !!!")
        
End Sub
    End Class
End
Namespace

 



And here are the details for the job:

Name: Test Timer Job
Status: Enabled
DaysToRun: Everyday
HoursToRun: Set to 6PM
Assembly: TestTimerJobAssembly,  Version=1.0.0.0, Culture=neutral, PublicKeyToken=9f4da00116c38ec5
Class: TestTimerJobAssembly.TimerJobs.TimerJobClass
Method: Execute
ConstructorParameter1: http://ne-per-md1 (name of our sharepoint dev server)
ConstructorParameter2: /

The timer does run, as the LastRunDateTime is updated, but no eMail is sent. (I have used this email code in other places so know that it works)

Can you offer any advice?

Thanks in advance,

Sandy

 

 

Coordinator
Feb 17, 2009 at 9:43 PM
Hi sandy

Currently you don't have a valid constructor and you've configured your job to use a constructor with 2 parameters (http://ne-per-md1 and /)
Change the following line

Public Sub TestTimerSchedule(ByVal strURL As String, ByVal webURL As String)

to this

Public Sub New(ByVal strURL As String, ByVal webURL As String)


Now it should work if you have your mail settings configured to send the email.

Cheers
Feb 18, 2009 at 8:51 AM

Hi Damien,

Thanks for the quick response, but after making that change, still nothing happening.

Any other ideas?

Coordinator
Feb 19, 2009 at 6:11 AM

Sandy
 Ok then I guess that the Timer Job maybe caching the Assemblies.
You need to follow the steps below
  • Stop the Windows SharePoint Services Timer Service
  • Go to the following path C:\Documents and Settings\All Users\Application Data\Microsoft\SharePoint\Config\ there sould be a folder that has a GUID as a name.
  • Delete all files from this folder.
  • Uninstall your assembly from the GAC.
  • Install your new version to the GAC.
  • Reset IIS.
  • Start the Windows SharePoint Services Timer Service.

 And that's it... Your new code should now run.... I have a script that does all the above steps, if you are interested just email me and I'll send it to you.

Cheers
Damian

Mar 18, 2010 at 7:58 AM

Hi Damien,

I tried out the above steps but still couldnt see the result.

My code:

namespace Company.Global.ITSM.Survey.TimerJob
{
    public class ITSMTimerJob
    {

    public ITSMTimerJob()
    {
  
    }
    public void Execute()
    {       
        StreamWriter objReader;

        objReader = new StreamWriter("E:\\TestFile.txt");
        objReader.Write(DateTime.Now.ToString());
        objReader.Close();    
    }
    }
}

Config Details:

Name: ITSM_Survey_TimerJob

RunAtNextOpportunity : Checked

Status: Enabled
DaysToRun: Everyday
HoursToRun: Set to 6PM
Assembly: Company.Global.ITSM.Survey.TimerJob, 1.0.0.0, Culture=neutral, PublicKeyToken=872feffd9b3651f3

Class: Company.Global.ITSM.Survey.TimerJob.ITSMTimerJobMethod: Execute
ConstructorParameter1:

ConstructorParameter2:

The LastRunDateTime is updated, and RunAtNextOpportunity is Unchecked. but no file is created.

Please Suggest.

Thanks,

Sai

sgsaisreeanth@gmail.com

Coordinator
Mar 18, 2010 at 9:49 AM

Sai

Your Assembly line in the List reads -

Assembly: Company.Global.ITSM.Survey.TimerJob, 1.0.0.0, Culture=neutral, PublicKeyToken=872feffd9b3651f3

It probably should read -

Assembly: Company.Global.ITSM.Survey.TimerJob, Version=1.0.0.0, Culture=neutral, PublicKeyToken=872feffd9b3651f3

 

Thanks

Damian