Normalerweise mache ich sowas ja nicht, aber ... ich will die Function hiermit auch zur Diskussion stellen:
Function GetAllServerNames As Variant
'=========================================================================================================
' Purpose: Get a list of all NABs from NOTES.INI and read there all server names
'------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
' Parameters: None
'------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
' Returns: Array of all found server names
'------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
' Created by: Bernhard Koehler on 05.05.2004 Modified by:
'=========================================================================================================
Dim session As New NotesSession
Dim dbCurrent As NotesDatabase
Dim dbNAB As New NotesDatabase ("", "")
Dim viewNABServers As NotesView
Dim collNABViewCollection As NotesViewEntryCollection
Dim viewentryNABView As NotesViewEntry
Dim vColumnValues As Variant
Dim vAddressBooks As Variant
Dim szConfigAddressBooks As String
Dim aServers (0) As String
Dim vServers As Variant
Dim iLoop As Integer
Dim iEntries As Integer
Dim szCurrentServer As String
On Error Goto ErrorRoutine
'The default value:
GetAllServerNames = "lokal"
'Build a list of all of the user's address books:
szConfigAddressBooks = session.GetEnvironmentString ("Names", True)
'Did we found address books?
If szConfigAddressBooks = "" Then
Exit Function 'There are no more address books by setup ...
End If
vAddressBooks = Evaluate (|@Explode ("| & szConfigAddressBooks & |"; ",")|)
'Eliminate possible blanks:
For iLoop = 0 To Ubound (vAddressBooks)
vAddressBooks (iLoop) = Trim$ (vAddressBooks (iLoop))
Next
'Open all found address books and read the server names:
aServers (0) = "Lokal" 'the default value - we need an array for the next actions
vServers = aServers
Set dbCurrent = session.CurrentDatabase 'On which server we have to perform this operation ?
szCurrentServer = dbCurrent.Server
For iLoop = 0 To Ubound (vAddressBooks)
If dbNAB.Open (szCurrentServer, vAddressBooks (iLoop)) Then 'only continue if we could open the specified NAB !
Set viewNABServers = dbNAB.GetView ("($Servers)")
If Not (viewNABServers Is Nothing) Then 'Personal address books do not contain such a view !
Set collNABViewCollection = viewNABServers.AllEntries
'Loop through all Entries:
Set viewentryNABView = collNABViewCollection.GetFirstEntry ()
While Not viewentryNABView Is Nothing
vServers = Arrayappend (vServers, viewentryNABView.ColumnValues (0))
Set viewentryNABView = collNABViewCollection.GetNextEntry (viewentryNABView)
Wend
End If 'of "Is a public NAB"
End If 'of "NAB could be opened"
Set dbNAB = New NotesDatabase ("", "")
Next 'of "Loop through all NABs set up in the NOTES.INI
If Ubound (vServers) > 0 Then 'There is more than 1 server - add the "All Servers" option:
vServers = Arrayappend (vServers, "-Beliebiger Server-")
End If
GetAllServerNames = vServers
Exit Function
ErrorRoutine:
Call ErrorHandler ("GetAllServerNames")
Exit Function
End Function
Hinweise auf Denkfehler würden mich sehr interessieren !
Bernhard
Nachtrag:
Diese Function arbeitet lokal wie auf dem Server und bietet die Server, die jeweils dort bekannt gemacht wurden. Die Werte "lokal" bzw. "Alle Server" wurden spezifisch benötigt (Agent-Steuerung) und müssten im Fall des Falles wieder entfernt werden.