Upload id to ID Vault DB

Hi

I use this piece of script to auto upload an id to ID Vault.
But the SECidfPut function allways return an error (20111) of which the getAPIError does not return the error string.
Does someone knows what is missing in my code to upload the id correctly to ID Vault DB?

PortName = “”
fileNum% = FreeFile()
ServerName = VaultDB.Server
FileName = VaultDB.FilePath
ret = PathNetIDVConstruct(PortName, ServerName, FileName, pathName)
ret = NSFIVDbOpen(pathName, hdb)

Password = idpassword
Username = SearchName
ret = SECidfPut(Username,Password,CStr(IDFilename),0,ServerName,0,0,0)
Print "Error message: " + getAPIError (CInt(ret))

Subject: IBM provided button to upload id to vault

you can try this:

Sub Click(Source As Button)
On Error Goto err1
Dim ws As New NotesUIWorkspace
Dim Servername As String
Dim hKFC As Long
Dim session As New NotesSession
Dim user As String
Dim path As String

path = session.GetEnvironmentString(“KeyFileName”,True)

user = session.UserName

Servername = “type the vault server name here”

IDfilename = path

pwd:
Password = ws.Prompt(PROMPT_PASSWORD, “ID-Management - Password prompt”, “Please enter the Notes ID password.”,“”)

ret = SECKFMOpen(hKFC, IDfilename, Password, SECKFM_open_All, 0, 0)

If ret <> 0 Then Error 1212, “Error encountered - Please retry”

ret = SECidfPut(user,Password,IDFilename,0,Cstr(Servername),0,0,0)

If ret <> 0 Then Error 1212, “Error encountered - Please retry”

’ Close the database to free its resources

ret = NSFDbClose(hdb)

ret = SECKFMClose(hKFC,SECKFM_close_WriteIdFile,0,0)

If ret <> 0 Then Error 1212, “Error encountered - Please retry”
Msgbox “ID Upload successful”
Exit Sub
err1:
Print Error & “-” & Erl
Goto pwd
End Sub