Vielleicht hilf Dir das weiter. Jedoch der GetEntry für die ACL muss noch abgefangen werden, wenn jemand auf einen fremden Kalender zugreift und dessen PostOpen auslöst, jedoch keine Zugriffsrechte auf die ACL hat.
Weiter musst Du das Script beim "Update Tasks"-Agent Check checken nach hartcodiertem Servereinträgen. Sonst funktioniert's ned.
Sub Postopen(Source As Notesuidatabase)
Dim session As New NotesSession
Dim db As NotesDatabase
Dim acl As NotesACL
Dim entry As NotesACLEntry
Dim registration As New NotesRegistration
Dim currentagent As NotesAgent
Dim doc As NotesDocument
Dim agentenabled As Variant
Dim isadmin As Variant
Dim retmailserver1 As String
Dim retmailserver2 As String
Dim filename As String
Dim username1 As String
Dim username2 As String
Dim currentserver As String
Dim agentserver As String
Dim lastversion As String
Dim actualversion As String
Set db = session.CurrentDatabase
'***** "Update Tasks"-Agent Check *****
filename = db.FileName
username1 = LeftSub(filename,".")
username2 = db.Title
currentserver = db.Server
If currentserver = "" Then
'Database is on Local - No action here
Else
Set acl = db.ACL
Set entry = acl.GetEntry( currentserver )
registration.RegistrationServer = currentserver
On Error Resume Next
isadmin = entry.IsAdminServer
Call registration.GetUserInfo( username1, retmailserver1)
'Call registration.GetUserInfo( username2, retmailserver2)
If (isadmin) Or (currentserver=retmailserver1) Or (currentserver=retmailserver2) Then
'Database is on User's main mail server (which is NORMALLY also the Administration Server) - Go forward
'Get the right agent
Forall agent In db.Agents
If ( agent.Name = "Update Tasks|Update Tasks" ) Then
Set currentagent = agent
Exit Forall
End If
End Forall
'Get the current status (server/enabled)
agentserver = currentagent.ServerName
agentenabled = currentagent.IsEnabled
'Change status if necessary
If currentserver <> agentserver Then
currentagent.ServerName = currentserver
Call currentagent.Save
End If
If agentenabled = False Then
currentagent.IsEnabled = True
Call currentagent.Save
End If
End If
End If
'***** Notes-Versionen Check *****
lastversion = session.GetEnvironmentString("Version")
actualversion = TrimString(session.NotesVersion)
If lastversion = actualversion Then
'Keine Versionsänderung - keine Mail notwendig
Else
'Versionänderung - email an "Mail Version Report" absetzen / Notes.INI-Eintrag aktualisieren
Set doc = New NotesDocument(db)
doc.Form = "Memo"
doc.Subject = actualversion
doc.VersionNumber = LeftSub(actualversion,"|")
doc.VersionDate = RightSub(actualversion,"|")
doc.SendTo = "Mail Version Report"
Call doc.Send(False)
Call session.SetEnvironmentVar("Version",actualversion)
End If
End Sub