C-sharp, Microsoft, Microsoft SharePoint, Multilingual, Multilingual sites, PowerShell, SharePoint, SharePoint 2013, Variations, Windows PowerShell
“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.
- Go to “Site Actions” à“Site settings”;
Under “Site collection administration”, click “Variation Settings”,
The code below is in C# for the page above to change or update the “Variation Settings”;
The same code but this time in PowerShell,
Now we need to create labels; go back to “Site Settings”, under “Site Collection Administration” click “Variation Settings”;
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 😉
Now same code but PowerShell for creating variation labels;
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”,
- After creating hierarchies, the values should be yes under “Hierarchy is Created”,
To create Hierarchies in C#,
Now let’s create hierarchies in PowerShell,
Thank you and please write your comments or in case you have any questions.