In this code, I am trying to get the corresponding french URL variation. I am using this CSOM api
https://msdn.microsoft.com/en-us/library/office/jj954403.aspx
But I can't figure out how to use it. Does anyone know?
This doesn't seem to be defined in the Publishing object.
.Variations
Thanks
var ctx = SP.ClientContext.get_current(); var site = ctx.get_site(); var rootWeb = site.get_rootWeb(); var webProperties = rootWeb.get_allProperties(); ctx.load(site); ctx.load(rootWeb); ctx.load(webProperties); ctx.executeQueryAsync( function() { var varLabelsListId = webProperties.get_item('_VarLabelsListId'); var labelsList = rootWeb.get_lists().getById(varLabelsListId); var labelItems = labelsList.getItems(SP.CamlQuery.createAllItemsQuery()); ctx.load(labelItems); ctx.executeQueryAsync( function() { var url = rootWeb.get_serverRelativeUrl(); var object = new SP.Publishing.Variations.getPeerUrl(url, "en-US"); }, function() { } ); }, function() { } );