Sub InitializeDer läuft auch auf dem Server, aber nur wenn ich ihn manuell anstoße.
Dim session As New NotesSession
Dim db As NotesDatabase
Dim arcdb As New NotesDatabase("IchBinServer" , "IchBinEinDir/IchBinDieDB.nsf")
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim wert As Variant
Dim nextdoc As notesdocument
Set db = session.CurrentDatabase
Set dc = db.AllDocuments
Set doc = dc.GetFirstDocument
Do Until doc Is Nothing
Set nextdoc = dc.getnextdocument(doc)
wert = doc.GetItemValue("IchBinDerStatus") 'Status
If wert(0) = "Archiv" Then
Call doc.CopyToDatabase(arcdb)
Call Doc.Remove( True )
End If
Set doc = nextdoc
Loop
End Sub
Ersetze das mal durchTheoretisch wäre das i.O., praktisch lässt sich dann aber der Agent nicht speichern, weil Notes mault, dass 2 mal Dim arcdb vorkommt.
if session.IsOnServer then
Dim arcdb As New NotesDatabase("" , "IchBinEinDir/IchBinDieDB.nsf")
else
Dim arcdb As New NotesDatabase("IchBinServer" , "IchBinEinDir/IchBinDieDB.nsf")
end if
Dim arcdb As New NotesDatabase
if session.IsOnServer then
Set arcdb = New NotesDatabase("" , "IchBinEinDir/IchBinDieDB.nsf")
else
Set arcdb = New NotesDatabase("IchBinServer" , "IchBinEinDir/IchBinDieDB.nsf")
end if