0

My requirement is when browser is in English, Title column in Content Type (content type is attached with list) is rename as "Last Name" and when in German, it should be "Nachname". My below code ran successfully and can rename only in English, but I wonder how to rename in German as well.

$site = new-object Microsoft.SharePoint.SPSite("site collection url")
$web = $site.OpenWeb()
$ct=$web.ContentTypes["CT1"]  
$field = $ct.Fields.GetFieldByInternalName("Title")                            
$ct.FieldLinks[$field.Id].DisplayName ="Last Name"     
$ct.Update();

1 Answer 1

0

Your problem is related to the Multilingual User Interface (MUI), see a detailed description here.

You should use a script like this:

function Using-Culture ( 
   [System.Globalization.CultureInfo]   $culture = (throw "USAGE: Using-Culture -Culture culture -Script {…}"), 
   [ScriptBlock] 
   $script = (throw "USAGE: Using-Culture -Culture culture -Script {…}")) 
   { 
     $OldCulture = [Threading.Thread]::CurrentThread.CurrentCulture 
     $OldUICulture = [Threading.Thread]::CurrentThread.CurrentUICulture 
         try { 
                 [Threading.Thread]::CurrentThread.CurrentCulture = $culture 
                 [Threading.Thread]::CurrentThread.CurrentUICulture = $culture 
                 Invoke-Command $script 
         } 
         finally { 
                 [Threading.Thread]::CurrentThread.CurrentCulture = $OldCulture 
                 [Threading.Thread]::CurrentThread.CurrentUICulture = $OldUICulture 
         } 
   } 

Using-Culture de-DE { 
  $web = Get-SPWeb http://YourSharePointSite
  $ct = $web.ContentTypes["CT1"]
  $fl = $ct.FieldLinks["Title"]
  $fl.DisplayName = "Nachname"
  $ct.Update()
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.