One click deployment with SharePoint

Leave a comment

April 8, 2014 by Ravi C Khambhati

This post going to be helpful for those who is struggling with SharePoint deployment and will make their life lot easier.

I will explain the approach with example. So lets assume that below is the only step which we have to perform as a part of deployment.(sounds funny but do not want to confuse anyone)

1. Delete list

So this whole approach is 3 steps process,

Step 1: Prepare Config.XML file
With this steps you will list down all configuration required for the deployment. As of now I am planing two things Log file and email. So here is the configuration. You can update this as per your requirement.

<?xml version="1.0" encoding="utf-8"?>
  	<!-- if this value is true then folder will be created every day -->
  	<!-- format of folder for eg yyyy-dd-MM -->
    <!-- format of log file -->
    <!-- SMTP -->

Step 2: Prepare Parameters.XML file
With this step you will list down all environment specific parameters which will be based on your environment(IT,UAT,PROD, etc…). In our case we only need one because that’s the only environment specific entry we need.

<?xml version="1.0" encoding="utf-8"?>
  <Parameter Name="$Url" Value ="yoururl" />

Step 3: Prepare Operations.XML file
With this step you will list down all steps and prepare Operation.XML file. As mentioned earlier we are going to focus only on one steps. So here is the file for for the same,

<?xml version="1.0" encoding="utf-8"?>
  <Operation Name="DeleteList">
      <Parameter Name="URL" Value="$Url" />
      <Parameter Name="InternalListName" Value="Test" />

and that’s all we need. Once you have all this you are all set for deployment.

Now I have prepared PowerShell script which will perform all operations mentioned in Operations.XML file. As of now this script only support one operation and will continue to add more. You can also update as per your need. Basically this script has been dived in three files. I might divide Operations.ps1 into multiple files in future.

1. StartDeployment.ps1
This script will accept three parameters(Config.XML, Parameters.XML and Operations.XML) and will perform below steps,
a. Read all operation
b. Replace operation parameters with actual value if required (in this example it will replace $Url with actual value)
c. Display operation name and parameters
d. Call respected function(which will be in Operation.ps1 file)
e. Log operation to log file

2. Operations.ps1
This script will have functions to do operations mentioned in Operation.XML file. Currently it has only one.

3. Functions.ps1
This script will have reusable functions which is being used in both of the above file.

Below is sample output of the screen,



Below is sample output of log file,

<?xml version='1.0' encoding='utf-8' ?>
    <Parameter Key='$Url' Value='yoururl' />
    <Operation Name='DeleteList' StartTime='2014-04-08 02:18:00' EndTime='2014-04-08 02:18:00'>
        <Parameter Key='URL' Value='yoururl' />
        <Parameter Key='InternalListName' Value='Test' />

Please share your input, suggestions, questions

You can download all three powershell files from below location(rename file extension from doc to ps1 as WordPress is not allowing me to upload ps1 file),


Leave a Reply

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

You are commenting using your 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: