If you have a Sharepoint list for companies and another for contacts how do you make sure every bit of information is up to date? This is a feature I wanted to have – and of course this should happen automatically.
First I thought of making automatic workflows with Microsoft Sharepoint Designer but it became difficult to keep track of the sites, lists, columns and different workflows for these. The obvious solution for after the SPBackup project was to make another Windows Powershell script to do this configured by a XML-file and scheduled by Windows Scheduled Tasks.
I made an example of this kind of cross-list updates below and you can download the latest version of SPListSync from CodePlex – the example XML-file provided can be used in the demonstration below
Sharepoint list-sync. with Powershell script: http://www.codeplex.com/splistsync
- Create new address list for Companies:
- Create new address list for Contacts
- Create new column in the Contacts list for the Company link:
Add some sample companies, contacts and link these together.
- Check Windows Powershell installation
Make sure Windows Powershell is installed on the Sharepoint (WSS/MOSS) server. (Windows Server 2003 – download and install it from the Microsoft website. Windows Server 2008 – activate the feature through Server Manager.)
If you do not sign your scripts, you can enable unsigned scripts in Windows Powershell with the command Set-ExecutionPolicy Unrestricted as shown here on the screenshot:
- Check the Powershell script configuration XML file so that it fits your environment (see the documentation on CodePlex)
- Run the script from the Powershell to test the synchronization
- Schedule the script in Windows Scheduled tasks with the command:
%windir%\system32\WindowsPowerShell\v1.0\powershell.exe -command "& C:\SPListSync\SPListSync.ps1