GetLanguagesForSpeak Method

Retrieves the languages available for speech synthesis.

Request URI

URI parameters
Parameter Description


Required. A string containing "Bearer" + " " + access token.

Return value
A string array containing the language codes supported for speech synthesis by the Translator Services.

Ff512400.alert_note(en-us,MSDN.10).gif Note

Bing App ID is deprecated and is no longer supported.   Please obtain an access token to use the Microsoft Translator API. For details, go here.


Obtain an Access Token on the server-side

public static AdmAccessToken GetAccessToken()
    AdmAccessToken admToken;
    string headerValue;
    //Get Client Id and Client Secret from
    AdmAuthentication admAuth = new AdmAuthentication("clientid", "clientsecret");

    admToken = admAuth.GetAccessToken();
    // Create a header with the access_token property of the returned token
    headerValue = "Bearer" + " " + HttpUtility.UrlEncode(admToken.access_token);

    return admToken;
Invoke the AJAX method on the client-side

<html xmlns="">
<head runat="server">
    <script type="text/javascript">
        var languageCodes = "[\"de\", \"fr\", \"it\"]";
        function getLanguagesForSpeak() {
            PageMethods.GetAccessToken(OnSucceeded, OnFailed);

        function OnSucceeded(result, usercontext, methodName) {

            window.mycallback = function (response) {
                var array = response;
                var languageNames = "";
                for (var i = 0; i < array.length; i++) {
                    languageNames = languageNames + array[i] + "<br />";
                document.getElementById('<%= lblResult.ClientID %>').innerHTML = languageNames;


            var s = document.createElement("script");
            s.src = " " + encodeURIComponent(result.access_token);
        function OnFailed(error, userContext, methodName) {
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager" runat="server" EnablePageMethods="true" />
        <asp:Button ID="buttonLangSpeak" runat="server" Text="Get Language names" OnClientClick="getLanguagesForSpeak();return false;" />
        <br />
        <asp:Label ID="lblResult" runat="server"></asp:Label>