OpenNTF.org - Open DB and create a new repli
My Links (Not logged in)
Code Bin Search
 
Hosted by Prominic.NET
Rate This Code
5 - brilliant stuff
4 - very nice
3 - average
2 - needs work
1 - bad
   OpenNTF Code Bin
About This Code
Brief Description:
Open DB and create a new replica and set new value in notes ini 
Rating:
Not Rated Yet 
Contributor:
Patrik Okouo 
Category:
Lotusscript 
Type:
Administration 
Last Modified:
05 Jan 2006 
OpenNTF Disclaimer

All of the program code and information presented in the OpenNTF.org Code Bin are provided "as-is", and should be used at your own risk. OpenNTF.org make no express or implied warranty about anything in the Code Bin, and OpenNTF.org will not be responsible or liable for any damage caused by the use or misuse of anything from this site. OpenNTF.org makes no guarantees about anything. Please thoroughly test all of the knowledge and code you find here before you attempt to use them in your production environment.

Code / Description
Sub Click(Source As Button)

Const DB_REMOVE_SERVER$ = ""
Const DB_DATABASE_SERVER$= "Mein Server"
Const DB_REMOVE_REPID$ = "0123456789012345"
Const DB_REPLICATE_REPID$ = "987654321"

On Error Goto ErrorHandler

Dim session As New NotesSession
Dim dbToRemove As NotesDatabase
Dim dbNewReplica As NotesDatabase
Dim strTitleDbToRemove As String

'Open Database by Replica ID
Set dbToRemove = New NotesDatabase("", "")
If dbToRemove.OpenByReplicaID(DB_REMOVE_SERVER, DB_REMOVE_REPID) Then

strTitleDbToRemove = dbToRemove.Title

'Ask
If Not Msgbox ("Gewählte Datenbank: " & strTitleDbToRemove & Chr(10) _
& "Diese Datenbank wirklich dauerhaft löschen?",1 + 32, "Sicher?") = 1 Then Exit Sub

'Remove Database
Call dbToRemove.Remove

'Final msg
Msgbox "Datenbank <" & strTitleDbToRemove & "> wurde gelöscht !", 64, ""

End If

'Open Db to replicate
Dim db As New NotesDatabase( "", "" )
If db.OpenByReplicaID( "RuemlangWHSrv/KMR/KABA", "C1256A3B002417C5" ) Then
Print( db.Title & " was successfully opened" )
Set replica = db.CreateReplica( "", "KABAMDC.nsf" )
Msgbox "please wait 3 minutes and restart Lotus Notes ",64,"Wait 3 Minutes"
Else
Print( "Unable to open database" )
End If



' Set new parameters in Notes.ini

Call session.SetEnvironmentVar( "Names", "names.nsf, KABAMDC.nsf", True )

GoOut:
Exit Sub
ErrorHandler:
Select Case Err
Case 4042: 'Database could not be deleted
Msgbox "Datenbank konnte nicht gelöscht werden, ein möglicher Grund: Ist gerade von einem anderen User geöffnet",64
Resume goOut
Case 4005: 'Database could not be deleted
Msgbox "Your Notes Set Up was up to date, enjoy your day",64, "Information"
Resume goOut
Case Else:
Msgbox "Fehler " & Err & " - " & Error$ & Chr(10) _
& "Fehler aufgetreten in Code-Zeile " & Erl, 48, "Laufzeitfehler"
Resume GoOut
End Select

End Sub

Usage / Example
 Comments

No documents found

 Add your comment!