3

Is it possible in SharePoint 2013 to create site columns, content types, lists, libraries, ... in different languages (so, with different display names) by CSOM (client server object model) or a webservice?

2

This is an old post. Just leaving this here for anyone to find. Extension method tricks SharePoint to believe you are accessing in the specified language. Tested and working in SP2013 and SPO. Requirement: Language must be installed in Farm and activated in SiteCollection

public static void ExecuteLocalizedQuery(this ClientRuntimeContext ctx, CultureInfo cltInfo)
{
    var back = ctx.PendingRequest.RequestExecutor.WebRequest.Headers["Accept-Language"];
    ctx.PendingRequest.RequestExecutor.WebRequest.Headers["Accept-Language"] = cltInfo.Name;
    ctx.ExecuteQuery();
    ctx.PendingRequest.RequestExecutor.WebRequest.Headers["Accept-Language"] = back;
}

You may then go and apply any elements you can think of e.g. Content Type name:

ct.Name = englishname;
ct.Update(true);
ct.Context.ExecuteLocalizedQuery(1033);
1

Tashunko's answer will only modify the pending request. If you want to set the language for all request for the lifetime of the ClientContext object you can set the Accept-Language header from an EventHandler.

public ClientContext Create(Uri webUri)
{
    var clientContext = new ClientContext(webUri);
    clientContext.ExecutingWebRequest += new EventHandler<WebRequestEventArgs>((s, e) => OnExecutingWebRequest(s, e);

    return clientContext;
}

private void OnExecutingWebRequest(object sender, WebRequestEventArgs e)
{
    e.WebRequestExecutor.RequestHeaders[HttpRequestHeader.AcceptLanguage] = Thread.CurrentThread.CurrentUICulture.Name;
}
0

Yes it is possible.

Look here CSOM vs JSOM vs SSOM vs REST and here Choose the right API set in SharePoint 2013.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.