[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Explode group to individual mail addresses by lotusscript

Posted on 2010-03-30
8
Medium Priority
?
1,800 Views
Last Modified: 2013-12-18
When I press F9 in lotus client, all of the group members are dissociated in the TO/CC/BCC fields. How to do it from lotusscript?
0
Comment
Question by:Amitava_Mukherjee
7 Comments
 
LVL 19

Assisted Solution

by:madheeswar
madheeswar earned 600 total points
ID: 29075323
F9 is similar to Call Uidoc.refresh
0
 
LVL 22

Accepted Solution

by:
mbonaci earned 1400 total points
ID: 29076959
Here's the recursive function (nested groups) from my CodeLibrary (template: http://www.openntf.org/Projects/pmt.nsf/ProjectLookup/Code%20Library) that returns array of all groups the user belongs to:
Function GetAllUsersInGroup( groupname As String, Server As String, maxdepth As Integer ) As Variant
%REM
	This function gets all the users in any group, including nested subgroups.
	This is a RECURSIVE function, so be careful when modifying it.
	MAXDEPTH is used to regulate how far down in group levels it can go.
	If checking ACL groups, 6 is the limit, for mail groups its 20 -- but this can change with Domino versions in the future.

	This sample code is distributed freely with only one obligation. You must distribute this code as a whole, including these comments, if you distribute it or re-use it at all. 
	For help, please contact
	andrewp@thenorth.com
	Andrew Pollack
	Northern Collaborative Technologies
%END REM

      ' use static variables so that you can avoid repeatedly
      ' getting a handle to the same resources.
      Static nab As notesdatabase
      Static nabview As notesview
      Static groupview As notesview
      Static foundlist List As String
      Static checkedgroups List As String
      Static depth As Integer

      ' this is the list containing the results to return
      Dim returnlist List As String

      ' just a stray string variable to be used
      Dim tempstring As String

      ' set this to return the empty list, in case we have to exit due to error
      getallusersingroup = returnlist

      ' since depth is a static variable, each recursive call to this
      ' function will increase its value.  We can also decrease its
      ' value so we know when we're back to the initial call.
      If depth => maxdepth Then Exit Function  ' don’t look deeper then n nested groups
      depth = depth + 1

      ' check to see if we haven't already connected to the nab & views
      ' if not, connect now.
      If nab Is Nothing Then Set nab = New notesdatabase(server,"NAMES.NSF")
      If nab Is Nothing Then Exit Function
      If nabview Is Nothing Then Set nabview = nab.getview("($ServerAccess)")
      If groupview Is Nothing Then Set groupview = nab.getview("($VIMGroups)")
      If groupview Is Nothing Then Exit Function
      If nabview Is Nothing Then Exit Function

      ' declarations
      Dim collection As notesdocumentcollection
      Dim doc, checkdoc As notesdocument
      Dim v As Variant
      Dim count As Integer
      Dim usercount As Integer
      Dim user As notesname

      ' Now we get to the meat of the function
      Set doc = groupview.getdocumentbykey(groupname, True) ' first, find the group

      If doc Is Nothing Then Exit Function ' there is no group

      Forall member In doc.members ' for each entry in the the group
            tempstring = Ucase$(member)
            ' *******************************************************
            ' make sure we haven't already checked this entry
            If Not Iselement(returnlist(tempstring)) Then
                  If Not Iselement(foundlist(tempstring)) Then
                        If Not Iselement(checkedgroups(tempstring)) Then
            ' *******************************************************
                              Set checkdoc = groupview.getdocumentbykey(tempstring, True)
                              If checkdoc Is Nothing Then
                              ' treat as a user, add them to the return and found lists
                                    foundlist(tempstring) = "1"
                                    returnlist(tempstring) = "1"
                              Else
		      		    ' this is a new group to check
                              ' so we recursively call this very function with the new groupname
                                    checkedgroups(tempstring) = "1"
                                    v = GetAllUsersInGroup( tempstring, server, maxdepth )
                                    Forall newmember In v
                                          ' add the results from the recursive call to the return lists
                                          returnlist(Listtag(newmember)) = "1"
                                          foundlist(Listtag(newmember)) = "1"
                                    End Forall
                              End If
                        End If
                  End If
            End If
      End Forall

      ' whew, now just return the list of all we found, plus all those found by
      ' any recursive calls we made, and the calls they made, and the calls they made, ...
      getallusersingroup = returnlist
      depth = depth -1

      If depth = 0 Then
	' this exit will be the last recursion, so delete the static list so we can run again if we need!
            Erase foundlist
            Erase checkedgroups
      End If

End Function

Open in new window

0
 
LVL 19

Expert Comment

by:madheeswar
ID: 29077344
Looks like my understanding was wrong. :(
0
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

 

Author Comment

by:Amitava_Mukherjee
ID: 29091256
I probably assigned all points to "madheeswar:", but I wanted to share "mbonaci:" and "madheeswar:" both as both have given me right solution, "madheeswar" give a better solution for me as it works for local as well as server group. My mistake, sorry for that, any way to split the points to both of them, I dont know, sorry again.
0
 
LVL 19

Expert Comment

by:madheeswar
ID: 29148731
Use the Request Attention link on the top and put your comments to split points.
0
 
LVL 11

Expert Comment

by:larsberntrop
ID: 29193577
Again: use the journaling function, so even mail sent by applications gets logged (and thus whitelisted)
0
 

Author Closing Comment

by:Amitava_Mukherjee
ID: 31708809
thanx to all of you, as i said earlier, the problem is solved by the mixture of the 1st two solutions. thanx once again
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
This video tutorial shows you the steps to go through to set up what I believe to be the best email app on the android platform to read Exchange mail.  Get the app on your phone: The first step is to make sure you have the Samsung Email app on your …
The video will let you know the exact process to import OST/PST files to the cloud based Office 365 mailboxes. Using Kernel Import PST to Office 365 tool, one can quickly import numerous OST/PST files to Office 365. Besides this, the tool also comes…
Suggested Courses

590 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question