0

Im trying to call this

https://docs.microsoft.com/en-us/dotnet/api/microsoft.sharepoint.publishing.variations.getpeerurl?view=sharepoint-server

    SP.SOD.executeOrDelayUntilScriptLoaded(function () {
        $.getScript("/" + _spPageContextInfo.layoutsUrl + "/sp.publishing.js", function () {
            var other_culture = _spPageContextInfo.currentCultureName === "en-US" ? "fr-FR" : "en-us";
            var ctx = SP.ClientContext.get_current();
            var object = SP.Publishing.Variations.getPeerUrl(ctx, window.location.pathname, other_culture);
            ctx.executeQueryAsync(Function.createDelegate(object, downloadURLSuccess), Function.createDelegate(object, downloadURLFail));
        });
    }, "sp.js");

    SP.SOD.executeFunc("sp.js", null, function () {});

    /**
     * 
     */
    function downloadURLSuccess(sender, args) {
        var otherURL = this.get_value();
        alert("Variation link is " + otherURL);
    }

    /**
     * 
     */
    function downloadURLFail(sender, args) {
        alert("Couldn't find variation link for " + window.location.pathname + args.get_message());
    }

But I always get

"Specified argument was out of the range of valid values.
Parameter name: labelTitle"

Does anyone know what I am doing wrong?

Is there a way I can see all possible values?

Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.