How to get alternate languages from language settings in SharePoint online using Rest API?

get alternate languages from language settings in SharePoint online using Rest API

In this post we will discuss how we can retrieve alternative languages using Rest API in SharePoint Online. You can see the alternative language from Site settings -> then Language Settings which is under “Site Administration” section. In one of the post, I have already explained how to retrieve using JavaScript client object model.

get alternate languages from language settings in SharePoint online using Rest API
get alternate languages from language settings in SharePoint online using Rest API

Below is the full code which I have put in a script editor web part inside a web part page. You can use the code according to your requirement.

<script src=”https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js”></script>

<script>

$(function(){

$(“#btnClick”).click(function(){

var requestUri = _spPageContextInfo.webAbsoluteUrl + “/_api/web/supportedUILanguageIds”;

$.ajax({

url: requestUri,

type: “GET”,

headers: {

“accept”:”application/json;odata=verbose”,

“content-type”: “application/json;odata=verbose”,

“X-RequestDigest”:$(“#_REQUESTDIGEST”).val()

},

success: onSuccess,

error: onError

});

function onSuccess(data) {

var value = data.d.SupportedUILanguageIds.results;

alert(value);

for (var i=0; i<value.length; i++) {

alert(value[i]);

}

}

function onError(error) {

alert(‘Error’);

}

});

});

</script>

<input type=”button” id=”btnClick” value=”Get AlternateLanguages”/>

get alternate languages from language settings in SharePoint online using Rest API
get alternate languages from language settings in SharePoint online using Rest API


Hope this will be helpful.

Check out Best Alternative to InfoPath -> Try Now

You May Also like the Following SharePoint Online Tutorials:

About Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SharePointSky.com

View all posts by Bijay Kumar →