Jesper M. Christensen

SharePoint and Security

Sharepoint list-synchronization with Powershell 1.0


 

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

 

Sharepoint list-connections

SPListSync_list-link

 

Setup procedure

 

  1. Create new address list for Companies:

           SPListSync-pic1         SPListSync-pic2

           SPListSync-pic3

  1. Create new address list for Contacts

              SPListSync-pic1        SPListSync-pic2

             SPListSync-pic4

  1. Create new column in the Contacts list for the Company link:

             SPListSync-pic5

             SPListSync-pic6

Add some sample companies, contacts and link these together.

  1. 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:

                                     SPListSync-pic7

  1. Check the Powershell script configuration XML file so that it fits your environment (see the documentation on CodePlex)
  2. Run the script from the Powershell to test the synchronization
  3. Schedule the script in Windows Scheduled tasks with the command:

    %windir%\system32\WindowsPowerShell\v1.0\powershell.exe -command "& C:\SPListSync\SPListSync.ps1

 

Advertisements

One response to “Sharepoint list-synchronization with Powershell 1.0

  1. Jerry November 22, 2013 at 16:15

    Outstanding!!!

    And it still works in SharePoint 2013

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: