Expanding groupnames recursively

What’s wrong with my code?I’m trying to get a list of notes names, from nested Group names.

When the function calls itself recursively, instead of expanding the name, it just gives the group name again.

so groupMembers, instead of being a nice array like the first time around, is just the group name, again.

Thanks for any help!

Marcia

‘’‘’‘’‘function below’‘’‘’‘’’

in declarations:

Dim view As notesview

Dim entry As notesviewentry

Dim distList() As String

Function RecursivelyExpandGroups(groupName$)

groupMembers = Evaluate( |@ExpandNameList(“servername”:“names.nsf”;“| & groupName$ & |”)| )

    Forall nam In groupMembers

        Print nam

        'check to see if nam is a group:	

        Set entry=view.getentrybykey(nam,True)

        If Not entry Is Nothing Then

'it is a group, expand it

Print nam + "   is a group"

n$=nam

Call RecursivelyExpandGroups(n$)

       Else

'it's not a group, add it to the distribution list

top%=Ubound(distList)+1

Redim Preserve distList( top% )

distList(top%)= nam

'distList = Arrayappend(distList, nam)

      End If

End Forall

End Function

Subject: expanding groupnames recursively…

You should try something like this:

Sub RecursivelyExpandGroups(groupName$)

strEval$ = |@ExpandNameList(@Subset(@DbName;1);"|+groupName$+|")|



groupMembers = Evaluate( strEval$ )

Forall nam In groupMembers

	Print nam

'check to see if nam is a group:

	Set entry=view.getentrybykey(nam,True)

	If Not entry Is Nothing Then

'it is a group, expand it

		Print nam + " is a group"

		n$=nam

		Call RecursivelyExpandGroups(n$)

	Else

'it’s not a group, add it to the distribution list

		top%=Ubound(distList)+1

		Redim Preserve distList( top% )

		distList(top%)= nam

'distList = Arrayappend(distList, nam)

	End If

End Forall

End Sub

Let me know if this helps!

(I renamed to “Sub” because the concept of Function is to return something and as you only make a simple call, I thought “Sub” fits better. Even for a recursively call!)

HTH

-Gabriel Amorim

Subject: RE: expanding groupnames recursively…

It is always good to point that as @ExpandNameList is an undocumented function it is not supported.

Relate to: http://www-1.ibm.com/support/docview.wss?uid=swg21101582

Subject: RE: expanding groupnames recursively…

Thanks for all help. I was in a real rush but found this posting here:http://www-10.lotus.com/ldd/nd6forum.nsf/55c38d716d632d9b8525689b005ba1c0/be014d28985a427f8525716900835a0e?OpenDocument&Highlight=0,getgroupmembers

  • which worked.

M