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

Error create repository with VBScript API

bsalzema
Contributor

Hi Everybody,

I would like to create repositories using VBScript API.

 

 

EnvPath = "\\Aip-Hopex\MEGA\Bases\TestV2"
sAdministrator = "Administrator"
sAdminPwd = ""

'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
Set oRepositories = oEnvironment.Databases

sRepositoryName = "Test01"
sRepositoryPath = sEnvPath & "\Db\" & sRepositoryName
msgbox sRepositoryPath

'create a repository
Set oDB=oRepositories.Create(sRepositoryName,sRepositoryPath)
 
I get the following error:
 
C:\Mega\Bases\Test_CreateBases.vbs : MegaDatabases.Create line 22, offset 2 :
Error(0x80020009) : Il n'existe pas de 'Référentiel MEGA' ayant pour 'Identifiant absolu' la valeur 'XmFN2DcwNHvJ'
 
If someone have an idea , I will be very happy !
Thanks,

 

6 Replies

We already use a HOPEX V2 release 

 

It has been tested with HOPEX V1R3. It does not mean it cannot work with HOPEX V1R2

There may be another issue. It will be not be easy to investigate give the status of the version

 

HOPEX V1R2 is in limited support phase that will end in december 2016.

http://community.mega.com/t5/General-Information/Support-Policy/ta-p/6216

It is important that you consider upgrade to HOPEX V1R3 or HOPEX V2

Jerome

Hello Jerome,

This script works with HOPEX V1R3 release but ours is a V2 release.

This script throws this error : Error(0x80020009) : Il n'existe pas de 'Référentiel MEGA' ayant pour 'Identifiant absolu' la valeur 'ofVYgfuwNDdH'

 

 

Here is a code example  (VB script, tested with HOPEX V1R3 CP14)

 

sEnvPath = "C:\_StandardData\750_cp14_V1R3_Demonstration"
sAdministrator = "Administrator"
sAdminPwd = ""
sRepositoryName = "MyDatabase2"
sRepositoryPath = sEnvPath & "\Db\" & sRepositoryName
'open environnement in administration session
Set oMegaApp = CreateObject("Mega.Application")
MsgBox "Installation used: " & oMegaApp.Path
Set oEnvironment = oMegaApp.Environments.Item(sEnvPath)
MsgBox "Environment opened: " & oEnvironment.Name
oEnvironment.CurrentAdministrator = sAdministrator
oEnvironment.CurrentPassword = sAdminPwd
Set oRepositories = oEnvironment.Databases
'create a repository
Set oRepository = oRepositories.Create(sRepositoryName,sRepositoryPath)
MsgBox "Repository created: " & oRepository.Name
'close environment
Set oRepositories = Nothing
MsgBox "End of processsing"
Set oMegaApp = Nothing

 

Jerome

Hello Jerome,

I use a GBMS storage

Thanks, Bruno

jhorber
MEGA
MEGA

Hello bsalzema

 

Check the type of storage used because the expected code varies according to the storage.

 

With GBMS storage

Create (RepositoryName, RepositoryPath)

 

With SQL Server storage

Create (RepositoryName, RepositoryPath, ConnectionString)

 

Where ConnectionString

TYPE=SQLSERVER ;SERVER=<instance> ;IUD=<user> ;PWD=<password>

Example of ConnectionString

"TYPE=SQLSERVER ;SERVER=myserver\myinstance ;UID=mysuser ;PWD=mypassword"

Jerome