Forum Discussion
bhanu chintha
Sep 19, 2017Iron Contributor
PnP Timer Job - OnPremise Connectivity - Run Method Call
Hello, I have written a TimerJob based on PnP Framework and tried to connect to the SP 2013 On-Premise site. https://msdn.microsoft.com/en-us/pnp_articles/timerjob-framework I have used ...
- Sep 19, 2017As far as I remember, you have to take care about PnP version to be used since there is a separation between PnP for SPO and PnP for SP OnPrem
Sep 19, 2017
As far as I remember, you have to take care about PnP version to be used since there is a separation between PnP for SPO and PnP for SP OnPrem
bhanu chintha
Sep 19, 2017Iron Contributor
Hello Juan,
Thanks for your reply.
I am using the OfficeDevPnP.Core.Framework.TimerJobs api here. So, I think this should be intelligent enough to handle connections to SP Online/OnPremise.
Here is the code that i have written -
class Program
{
static void Main(string[] args)
{
Class1 job = new Class1();
job.AddSite("https://OnPremSiteURL");
job.UseNetworkCredentialsAuthentication("username", "password", "domain");
job.Run();
}
}
class Class1 : TimerJob
{
public Class1() : base("CustomListArchivalJob")
{
TimerJobRun += Class1_TimerJobRun;
ManageState = true;
}
private void Class1_TimerJobRun(object sender, TimerJobRunEventArgs e)
{
}
}
Thanks & Regards,
Bhanu