Shifting the Bits of My Mind

Programming

07/10/2009

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:

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

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.