Hallo,
wie der Zufall so spielt, hab ich gerade gebaut:
Option Public
Option Declare
'Declarations
Type unames
name As String
nachname As String
vorname As String
End Type
Sub Initialize
Dim session As New notessession
Dim nlist List As unames
' Gewünschte Gruppe übergeben
Call get_member(session, "Administratoren", nlist)
' und namen ausgeben
Forall x In nlist
Print x.name
End Forall
End Sub
Function get_member(session As notessession, sg As String, nlist List As unames) As Variant
Dim nslist List As unames
Dim un As unames
Dim db As notesdatabase
Dim view As notesview
Dim dc As Notesdocumentcollection
Dim ndoc As notesdocument
Dim cutoff As New Notesdatetime("1.1.1990")
Dim sbeg As String
Dim sgroup As String
Dim s As String
Dim vy As Variant
Dim i As Integer
Set db = session.currentdatabase
' names nsf verbinden
Dim dbnab As New NotesDatabase( db.server, "names.nsf" )
If dbnab.isopen = False Then
Call dbnab.openWithFailover( "", "" )
End If
Set view=dbnab.getview("($VIMGroups)")
' Voreinstellung holen
sbeg = Trim(Ucase(sg))
If sbeg = "" Then
get_member = ""
Exit Function
End If
' Alle gruppen suchen
s= "Type = 'Group' & @UpperCase(@left(Listname;" + Cstr(Len(sbeg)) + ")) = '" + sbeg + "'"
Set dc = dbnab.search(s,cutoff,0)
Set ndoc = dc.GetFirstDocument()
While Not(ndoc Is Nothing)
sgroup = ndoc.listname(0)
s = "@rightback('" + sgroup + "'; '_')"
vy = Evaluate(s,ndoc)
Call get_Members(ndoc.listname(0), nlist, view, Ucase(vy(0)))
Set ndoc = dc.GetNextDocument(ndoc)
Wend
Exit Function
End Function
Sub get_Members(sname, nlist List As unames ,view As notesview, sgroup As String)
' rekursiv, sollte Member Gruppe sein, dan wird Sub rekursiv nochmals hochgeholt
Dim u As New NotesName(sname)
Dim nname As notesname
Dim doc As notesdocument
Dim pos As Integer
Set doc=view.getDocumentByKey(u.Abbreviated,False)
If Not doc Is Nothing Then
Forall item In doc.Members
Call get_Members(item,nlist,view, sgroup)
End Forall
Else
Set nname = New notesname(sname)
sname =nname.canonical
nlist(sname).name = sname
pos = Instr(nname.common, " ")
If pos <> 0 Then
nlist(sname).vorname = Trim(Left(nname.common, pos))
nlist(sname).nachname = Trim(Mid(nname.common, pos,50))
End If
End If
Exit Sub
End Sub