Forum Discussion
PnP Timer Job - OnPremise Connectivity - Run Method Call
- 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
- bhanu chinthaSep 19, 2017Iron Contributor
I tried with SP 2013 nugget package and it worked fine.
But, I still doubt why the latest package do not work with SP 2013 when it has provided methods to connect to On-Premise environment. Is this a bug?
Thanks & Regards,
Bhanu
- bhanu chinthaSep 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