Hallo,
Na wenn die Adressbucher imme rim gleichen Pfad liefen ist das doch auch mit dem Script kein
Hexenwerk.
Mal so als Stichwort sei genannt: NotesDocument.CopyToDatabase
Andreas
Das war der Hint, den ich gebraucht habe! Ich denke nicht, das je jemand von euch sowas in KIX benötigt, aber man weiss ja nie
; ---------------------------------------------------------------------------------------------------
; Copy all contacts and local groups from one to another local address book
; ---------------------------------------------------------------------------------------------------
Function RestoreAddressbookEntries($oNotesSession, $FromNabPath, $ToNabPath)
Dim $oSourceDB
Dim $oTargetDB
Dim $ContactsView
Dim $Contact
Dim $GroupsView
Dim $Group
Dim $Ret
;
$oSourceDB = $oNotesSession.GetDatabase("", $FromNabPath)
$oTargetDB = $oNotesSession.GetDatabase("", $ToNabPath)
; ---------------------------------------------------------------------------------------------------
; Verify if The NAB is Open, If Not, Open it
; ---------------------------------------------------------------------------------------------------
If Not ($oSourceDB.isopen)
$Ret = $oSourceDB.open("", $oSourceDB.filename)
If @ERROR <> 0
$Ret = LogMessage("Unable to open source DB " + $FromNabPath + " to copy local contacts from!", "", "F")
Exit
EndIf
EndIf
If Not ($oTargetDB.isopen)
$Ret = $oTargetDB.open("", $oTargetDB.filename)
If @ERROR <> 0
$Ret = LogMessage("Unable to open target DB " + $ToNabPath + " to copy local contacts from!", "", "F")
Exit
EndIf
EndIf
; ---------------------------------------------------------------------------------------------------
; now copy the contacts to the new NAB
; ---------------------------------------------------------------------------------------------------
$ContactsView = $oSourceDB.getview("My Contacts")
$Contact = $ContactsView.GetFirstDocument
While @Error = 0
$Ret = $Contact.CopyToDatabase($oTargetDB)
If @ERROR <> 0
$Ret = LogMessage("error " + @SERROR + " occured during restore of a contact", "", "W")
EndIf
$Contact = $ContactsView.GetNextDocument($Contact)
Loop
; ---------------------------------------------------------------------------------------------------
; do the same with the groups...
; ---------------------------------------------------------------------------------------------------
$GroupsView = $oSourceDB.getview("Groups")
$Group = $GroupsView.GetFirstDocument
While @Error = 0
$Ret = $Group.CopyToDatabase($oTargetDB)
If @ERROR <> 0
$Ret = LogMessage("error " + @SERROR + " occured during restore of a contact", "", "W")
EndIf
$Group = $GroupsView.GetNextDocument($Group)
Loop
EndFunction