Showing results for 
Show  only  | Search instead for 
Did you mean: 

Change repository language using APIs

Occasional Contributor

Change repository language using APIs

I need to change the repository language after creation.

I cannot find something clear in the API documentation

Is there a function available for a MegaRepository object to do this?

Please provide a code example

Forums are fun. Let's post.
Tags (3)
4 Replies

Re: Change repository language using APIs



Thank you for your question.

What you want to do is an important change, see


If you want to do this change here is the solution


See you in the community.


Re: Change repository language using APIs

Thanks François


I now get an error that I cannot understand


I try to change the repository language using ChangeLanguage




I get the above error

Thread(0688);MEGA Automation Batch Exception : MegaDatabase.ChangeLanguage(0) : error Private: 0x00031001 14:48:18

              A MEGA Session cannot be entered for (Database.ChangeLanguage) while the Sessio

              n is locked by : Environment C:\Program Files\MEGA\MEGA 2009

               SP5\Demonstration, User Administrator : Database is Opened



A this step I have

- an object 'oRepository' (current repository)

- an object 'oFrLang' (object for the language 'Français') that I have obtained with this code


Set oRoot = oRepository.Open

Set oFrLang = oRoot.GetCollection("Language").Item("Français")

IdFrLang = oFrLang.GetId




What am I doing wrong?


Re: Change repository language using APIs



Please find the link related to your issue:

See you.



Change repository language using APIs

Code example for changing repository language with Method ChangeLanguage (VB script):


sEnvPath = "C:\Program Files\MEGA\MEGA 2009 SP5\Demonstration"
sAdministrator = "Administrator"
sAdminPwd = ""
sRepository = "Adventure" 'Target repository
sTargetLanguageName = "Français" 'Target language

'open environnement in administration session
Set oMegaApp = CreateObject("Mega.Application")
Set oEnvironment = oMegaApp.Environments.Item(sEnvPath)
'MsgBox "Environment opened:" & oEnvironment.Name
oEnvironment.CurrentAdministrator = sAdministrator
oEnvironment.CurrentPassword = sAdminPwd

'get repository
Set oRepository = oEnvironment.Databases.Item(sRepository)
'Msgbox "Repository updated: " & oRepository.Name

'change current repository language to target language 
oRepository.ChangeLanguage(sTargetLanguageName )

Set oEnvironment = Nothing
'MsgBox "Environment closed"
Set oMegaApp = Nothing