Question

Can anyone tell me how to create variation labels using CSOM?

Was it helpful?

Solution

I dont think you can create the variation label using the CSOM. I think you need to use to the Powershell or c#. here is the blog:

Automate Variations in SharePoint 2013 Using PowerShell & C#

He wrote the code for both C# and script for PowerShell.

OTHER TIPS

How to create Variation Labels in SharePoint 2013/Online via CSOM

SharePoint 2010/2013 CSOM API does not expose any specific methods for creating Variation Labels, but you could use the following class for that purpose.

VariationsClient class is intended for managing Variation Labels in SharePoint 2013.
The following operations are currently supported:

  • VariationsClient.CreateLabel method is used for create Variation Label
  • VariationsClient.GetLabelsList method gets Variation Labels on site

Usage

using (var ctx = new ClientContext(url))
{ 
    var variationsClient = new VariationsClient(ctx);
    var siteLanguages = new[] {"en-US","ru-RU","fi-FI","nl-NL"};
    foreach (var language in siteLanguages)
    {
        var isSource = (language == "en-US");
        variationsClient.CreateLabel(new CultureInfo(language), isSource);    
    }
}

Result

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top