, , , , , , , , ,

“Thanks to Waldek Mastykarz for his post, he posted about it but for SP 2010 and only in C#” but then I was able to convert it to Powershell, also thanks to “Eric Soo” for his reply but I was done already but thank you both.”

Let’s Start.. Automating variations settings and configuration so whenever a deployment is needed, you will be ready with your PowerShell scripts.

Manual deployment is time consuming as it is repetitive task, in this post I will let you know how to automate one of those many tasks when it comes to deployment.

SharePoint Variations has a UI which I will show you its steps now;

The steps in this post is for automation of variation in UI, in C# & finally in PowerShell.

  1. Go to “Site Actions” à“Site settings”;
  2. Under “Site collection administration”, click “Variation Settings”,

  3. The code below is in C# for the page above to change or update the “Variation Settings”;

  4. The same code but this time in PowerShell,

  5. Now we need to create labels; go back to “Site Settings”, under “Site Collection Administration” click “Variation Settings”;

  6. I have 2 labels, currently if this is your first time, it will be empty, click now “New Label” (as if you are telling SharePoint List to create new item) since we will do this in the code 😉

  7. Now same code but PowerShell for creating variation labels;

  8. Now to create hierarchies; you should see the labels added as below, click above them “Create Hierarchies”, before creating hierarchies, the values for the labels are “No”,

  9. After creating hierarchies, the values should be yes under “Hierarchy is Created”,
  10. To create Hierarchies in C#,

  11. Now let’s create hierarchies in PowerShell,


    Thank you and please write your comments or in case you have any questions.