forked from SharePoint/PnP-Partner-Pack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFunctions.cs
More file actions
37 lines (32 loc) · 1.35 KB
/
Copy pathFunctions.cs
File metadata and controls
37 lines (32 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Azure.WebJobs;
using OfficeDevPnP.PartnerPack.Infrastructure.Jobs.Handlers;
using OfficeDevPnP.PartnerPack.Infrastructure;
using OfficeDevPnP.PartnerPack.Infrastructure.Jobs;
namespace OfficeDevPnP.PartnerPack.ContinousJob
{
public class Functions
{
// This function will get triggered/executed when a new message is written
// on an Azure Queue called queue.
public static void ProcessQueueMessage([QueueTrigger(PnPPartnerPackSettings.StorageQueueName)] ContinousJobItem content, TextWriter log)
{
log.WriteLine(String.Format("Found Job: {0}", content.JobId));
// Get the info about the Provisioning Job
ProvisioningJobInformation jobInfo =
ProvisioningRepositoryFactory.Current.GetProvisioningJob(content.JobId, true);
// Get a reference to the Provisioning Job
ProvisioningJob job = jobInfo.JobFile.FromJsonStream(jobInfo.Type);
if (PnPPartnerPackSettings.ContinousJobHandlers.ContainsKey(job.GetType()))
{
PnPPartnerPackSettings.ContinousJobHandlers[job.GetType()].RunJob(job);
}
log.WriteLine("Completed Job execution");
}
}
}