Created
December 13, 2013 10:34
-
-
Save splessons/7942491 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using Microsoft.SharePoint; | |
using Microsoft.SharePoint.Administration; | |
namespace customtimerjob.SPJobs | |
{ | |
class SPTImerJobClass : SPJobDefinition | |
{ | |
public SPTImerJobClass() : base() { } | |
public SPTImerJobClass(string jobName, SPService service): base(jobName, service, null, SPJobLockType.None) | |
{ | |
this.Title = "Task Complete Timer"; | |
} | |
public SPTImerJobClass(string jobName, SPWebApplication webapp): base(jobName, webapp, null, SPJobLockType.ContentDatabase) | |
{ | |
this.Title = "Task Complete Timer"; | |
} | |
public override void Execute(Guid targetInstanceId) | |
{ | |
SPWebApplication webapp = this.Parent as SPWebApplication; | |
SPList tasklist = webapp.Sites[0].RootWeb.Lists["Tasks"]; | |
SPListItem newTask = tasklist.Items.Add(); | |
newTask["Title"] = "New Task" + DateTime.Now.ToString(); | |
newTask.Update(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment