When you develop actions (or workflows) that should be executed when an expiration policy occurs you need to test them, but Expiration Policy job only is scheduled to run once a day.
You can execute this C# code to force the execution of the job:
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using Microsoft.SharePoint.Administration;
namespace RunExpirationPolicy
{
class Program
{
static void Main(string[] args)
{
foreach (SPService srv in SPFarm.Local.Services)
{
foreach (SPJobDefinition job in srv.JobDefinitions)
{
string jobTitle = job.Title;
if (jobTitle == "Expiration policy")
{
job.Execute(Guid.Empty);
}
}
}
}
}
}
You can use it to force any moss job. You only have to change the name of the job in the IF condition.
No hay comentarios:
Publicar un comentario