I have data-source to import data from into a SharePoint list.

One of my colleague is working on the code, but the issue how We don't know can run that JS file in SharePoint. So that it will automatically run and import data into SharePoint on Weekly basis.

It will going to deploy on both SharePoint Onprem and Online

Note: I am not a coder..

  • Its just a JS file. Nothing related to SharePoint ? I mean code written must be CSOM right ? – Bhaskar Dhone Feb 4 '17 at 9:18
  • Yes, It will be CSOM – cjs Feb 6 '17 at 10:31

You cannot automate running of a JavaScript code in SharePoint site. The page in which JavaScript is loaded should be browsed manually or through some tool to run the code.Also JavaScript based component is not the right choice for what you are trying to do.

Below is one common practice for what you are trying to achieve:

  1. You need to create a console application and use CSOM to import data to SharePoint. See here for CSOM operations on a list
  2. Schedule the job to run every week in Windows task scheduler in a remote server.
|improve this answer|||||
  • but how to achieve this when I am working of SharePoint Online, then there would be no server. Also I just heard of something called Timer Job in SharePoint, can we do something with that for this schedule ! – cjs Feb 6 '17 at 10:31
  • You cannot create SharePoint timer job in SP online. You can create a Azure Webjob which does the import. Check this docs.microsoft.com/en-us/azure/app-service-web/… – Unnie Feb 7 '17 at 9:11

You can create a Windows Azure Timer Job and use CSOM (Client-side object model) as an alternative to a full thrust timer job.

SharePoint Timer Jobs running as Windows Azure Web Jobs: http://blogs.msdn.com/b/richard_dizeregas_blog/archive/2014/04/07/sharepoint-timer-jobs-running-as-windows-azure-web-jobs.aspx

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.