// Uncomment the method below to handle the event raised after a feature has been activated. public override void FeatureActivated(SPFeatureReceiverProperties properties) { var app = properties.Feature.Parent as SPWebApplication; RemoveJobIfRegistered(app); var clientAccessPolicyJob = new ClientAccessPolicyDeploymentJob(JobName, app); var schedule = new SPOneTimeSchedule(DateTime.Now); clientAccessPolicyJob.Schedule = schedule; clientAccessPolicyJob.Update(); app.JobDefinitions.Add(clientAccessPolicyJob); app.Update(); clientAccessPolicyJob.RunNow(); }
public override void FeatureActivated(SPFeatureReceiverProperties properties) { var site = properties.Feature.Parent as SPWebApplication; RemoveJobIfRegistered(site); var clientAccessPolicyJob = new ClientAccessPolicyDeploymentJob(JobName, site); var schedule = new SPOneTimeSchedule(DateTime.Now); clientAccessPolicyJob.Schedule = schedule; #if SP2013 clientAccessPolicyJob.FeatureCompatibilityLevel = properties.Definition.CompatibilityLevel; #endif clientAccessPolicyJob.Update(); site.JobDefinitions.Add(clientAccessPolicyJob); site.Update(); //Disabled running this job for now, the administrator can choose to run it or copy the file manually //there are considerations with deploying this file, what if one exists already, does the administrator approve of it without seeing it //clientAccessPolicyJob.RunNow(); }