Creating variation labels using CSOM in sharepoint 2013
-
29-09-2020 - |
Question
Can anyone tell me how to create variation labels using CSOM?
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 LabelVariationsClient.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
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange