Many companies have SharePoint servers that they use to manage their documents, so why not manage templates too? The short answer has always been that it meant that the template had to be manually checked out before it could be used thus making it an annoying and tedious process.
Enter PowerShell, Microsoft's answer to the well known bash shell and the functionality that it provided UNIX and Linux sysadmins. PowerShell allows us to call the .Net assemblies for the Windward .NET engine directly as well as the managed assemblies for SharePoint.
Setting it all up
To reference the code in the SharePoint or Windward assemblies we have to load them:
Now that the assemblies are referenced we can go to work:
Ok we've opened the SharePoint Site, it is important to note at this time that only users with read permissions on the WSS_content will be able to successfully complete the above steps. Our next step will be to get the document we want
So we now have our template in hand, now for the engine. From this part forward this is going to look like the Standard RunReport Sample app that ships with the Windward .NET engine
#The public test datasource
"Data Source=MSSQL.windwardreports.com;Initial Catalog=Northwind;User Id=demo;Password=demo;")
A few things you'll need to know...
To use the Windward .Net Engine with PowerShell you will need to create a powershell.exe.config, I suggest modeling it off the one in the RunReport Sample app, and copy it to the PowerShell directory, this will allow the engine to properly validate your license when you run it, otherwise the engine will fail every time. Furthermore you can do more than just SharePoint with PowerShell and the engine, anything that you would right a .Net app for you can do with PowerShell. So for a simple run script PowerShell is ideal.