Get users names in group

HiWhat is the most efficient way using script to access the acl of a database…get groups listed as well as members of group?

Thanks in advance.

C

Subject: Get users names in group

coll,

Read the Designer Help about NotesDatabase.ACL property

Then you can loop through the entries in the ACL

Mike

Subject: Get users names in group

To get the list of all the users available in groups use the following formula:

@ExpandNameList(server : “names.nsf”; groupName)

This is undocumented formula. Use the above in LS with “Evaluate” function.

–Phani

Subject: Get users names in group

Here is some lotusscript I wrote which we use to do the job. You need to pass in an array of the names/ groups to be exploded, and the replica ID of your name and address book. An array of names is returned.

Hope this helps,

Craig.


Function ExplodeNames( nameslist As Variant, nabrepid As String ) As Variant

' --- Set explodenames here so if we exit it will be passed back unchanged

ExplodeNames = nameslist



Dim session As New NotesSession

Dim nab As NotesDatabase

Dim nabview As NotesView

Dim nabdoc As NotesDocument



Dim blankarray( 0 ) As String

Dim tocheck As Variant

Dim tocheckname As NotesName

Dim checked As Variant

Dim peoplenames As Variant



' --- Open the name and address book

While Instr( nabrepid, ":" ) > 0

	nabrepid = Strleft( nabrepid, ":" ) & Strright( nabrepid, ":" )

Wend

If Len( Trim( nabrepid ) ) = 0 Then Exit Function

If Len( Trim( nabrepid ) ) <> 16 Then Exit Function



Set nab = New NotesDatabase( "", "" )

If Not( nab.OpenByReplicaID( "", nabrepid ) ) Then

	If Not( nab.OpenByReplicaID( session.CurrentDatabase.Server, nabrepid ) ) Then

		Print "Error : Could not open the NAB"

		Exit Function

	End If

End If



' --- Get the name lookup view

Set nabview = nab.GetView( "($NamesFieldLookup)" )



' --- Loop through the list of names and explode them out to peoplenames

tocheck = nameslist

checked = blankarray

peoplenames = blankarray

While Len( Trim( tocheck( Lbound( tocheck ) ) ) ) > 0

	' --- Remove the domain from any names as they are not shown in the lookup view we are using...

	If Instr( tocheck( Lbound( tocheck ) ), "@" ) > 0 Then tocheck( Lbound( tocheck ) ) = Strleftback( tocheck( Lbound( tocheck ) ), "@" )

	Set tocheckname = New NotesName( tocheck( Lbound( tocheck ) ) )

	

	If Isnull( Arraygetindex( checked, Lcase( tocheckname.Abbreviated ) ) ) Then

		Set nabdoc = nabview.GetDocumentByKey( Lcase( tocheckname.Abbreviated ) )

		If Not( nabdoc Is Nothing ) Then

			If nabdoc.Type( 0 ) = "Group" Then

				tocheck = Arrayappend( tocheck, nabdoc.Members )

			Else

				peoplenames = Arrayappend( peoplenames, nabdoc.FullName( 0 ) )

			End If

		End If

		checked = Arrayappend( checked, Lcase( tocheckname.Abbreviated ) )

	End If

	

	tocheck( Lbound( tocheck ) ) = ""

	tocheck = Fulltrim( tocheck )

Wend



ExplodeNames = peoplenames

End Function