![]() ![]() The sample in this article prompts the user to provide a password or client secret (see more in the Authentication section), which works while testing but does not work when deployed. Using Windows Server as the hosting platform.ĭeploy timer jobs to Azure using Azure WebJobsīefore deploying a timer job, ensure that the job can run without user interaction.The following sections describe the two most common hosting platform options: ![]() Depending on the chosen hosting platform, the deployment differs. exe file that must be scheduled on a hosting platform. The next step is to deploy the timer job.Ī timer job is an. The previous step demonstrates a simple timer job. The provided credentials need access to the site collections you want to "pwd") Start the timer job by calling the Run method. The timer job runs on all sites that match this wild card URL. This example uses a wild card character in the URL. This example uses the user name and password to authenticate against SharePoint Online.Īdd one or more sites for the timer job program to access. Provide the authentication details for the timer job. To do so, update Program.cs by using the following steps: The timer job created in the previous step still needs to be executed. Step 3: Update Program.cs to use the timer job Void SimpleJob_TimerJobRun(object sender, TimerJobRunEventArgs e)Į.WebClientContext.Load(e.WebClientContext.Web, p => p.Title) Ĭonsole.WriteLine("Site ", e.Url, e.) The result will be similar to the following: using System In the constructor, give the timer job a name ( base("SimpleJob")) and connect the TimerJobRun event handler.Īdd your timer job logic to the TimerJobRun event handler. Have the class inherit the TimerJob abstract base class. Step 2: Create a timer job class and add your timer job logicĪdd a class for the timer job named SimpleJob. You will be responsible for keeping this code updated with the latest changes added to PnP. The goal of this sample is to provide the reader a quick view later on we provide a more detailed explanation of the timer job framework. In this section, you will learn how to create a very simple timer job.
0 Comments
Leave a Reply. |