361 Lotus blogs updated hourly. Who will post next? Home | Downloads | Events | Pods | Blogs | Search | myPL | About 
 
Latest 7 Posts
Gone fishing. Or rather gone scuba diving.
Sat, Nov 22nd 2014 54
Free Code – Class to read URL name-value pairs
Thu, Nov 20th 2014 130
Verizon and AT&T are tracking all your online activity
Fri, Oct 31st 2014 126
Nokia is dead
Wed, Oct 22nd 2014 225
October Community Webcast – Wednesday October 15
Mon, Oct 13th 2014 79
Microsoft skipping Windows 9 – jumps to Windows 10
Tue, Sep 30th 2014 47
Free Software – Password Reset for Notes/Domino
Wed, Sep 24th 2014 82
Top 10
Nokia is dead
Wed, Oct 22nd 2014 225
Export from Notes to Excel – 3 different ways
Wed, Nov 14th 2012 169
“Migrate from legacy systems like Outlook/Exchange to IBM Notes”
Wed, Sep 3rd 2014 154
Export Notes view to Excel – with multi-value fields
Fri, Apr 5th 2013 143
Free Code – Class to read URL name-value pairs
Thu, Nov 20th 2014 130
Verizon and AT&T are tracking all your online activity
Fri, Oct 31st 2014 126
Create and update Calendar reminders from Notes document
Thu, Aug 11th 2011 105
Free Tool: Analyze ACL in Notes Application/Database
Tue, Nov 15th 2011 93
Regular Expressions in Notes (Lotusscript)
Tue, May 29th 2012 90
Free Software – Password Reset for Notes/Domino
Wed, Sep 24th 2014 82


Free Tool: Clean your NAB
Karl-Henry Martinsson    

As a follow-up to my previous tool that let you analyze the ACL of a database, I built another tool for my admin. For different reasons, we need to keep the mailbox of terminated users, sometimes for a shorter time but sometimes for long periods of time. As far as I understand it, if a traditional approach was used to remove a user from the system, the mail file would also be deleted. So the admin put the terminated user in the Deny Access group and change the ACL of the mailfile to include a manager, supervisor or replacement.

But because of this process, AdminP will not remove the terminated user from all the groups he/she is listed in. When you have hundreds of groups, many of them nested, this could be a real headache. So I was asked to build something simple that allows us to remove one or more specified users from all groups in the Domino Directory. Below is the result. Enjoy!

 

First you create a form with 3 fields:

Form with 3 fields

'SaveOptions' has a default value of "0" (to prevent the form from being saved).
'Users' is a Names field, getting it's values using the addresses dialog. The field is multi-value and using New Line as separator.
'LogResult' is a multi-value text field, again with New Line as separator.

Finally I add a button to the action bar to remove the user(s). The Lotusscript code is listed below. It is using my class for mail notifications that I blogged about last year to send a confirmation to the user running the agent. This is useful for example when you need to log all data changes done to a system.

Use "Class.MailNotification"

Sub Click(Source As Button)
 Dim ws As New NotesUIWorkspace
 Dim uidoc As NotesUIDocument
 Dim session As New NotesSession
 Dim nab As NotesDatabase
 Dim view As NotesView
 Dim doc As NotesDocument
 Dim members As Variant
 Dim newmembers List As String
 Dim delmembers List As String
 Dim users As Variant
 Dim userlist List As String
 Dim user As NotesName
 Dim nmcnt As Integer
 Dim newarray() As String
 Dim ret As Integer
 Dim removelog List As String
 Dim userarr As Variant
 Dim mail As NotesMail 
 Dim mailtext As String
 Dim updated As Boolean
 
 ' *** Make sure the operator is sure
 ret = Msgbox("Are you sure?",4+32+256,"WARNING")
 If ret = 7 Then
  Exit Sub
 End If
 
 ' *** Get a list of users in field 'Users'
 Set uidoc = ws.CurrentDocument
 users = Split(uidoc.FieldGetText("Users"),Chr$(13))
 Forall u In users
  Set user = New NotesName(u)
  userlist(Fulltrim(user.Common)) = Fulltrim(user.Common)
 End Forall
 
 ' *** Get all groups in NAB and process them one by one
 Set nab = New NotesDatabase(session.CurrentDatabase.Server,"names.nsf")
 Set view = nab.GetView("Groups")
 Set doc = view.GetFirstDocument
 Do While Not doc Is Nothing
  Print "Processing " & doc.GetItemValue("Listname")(0)
  Erase newmembers
  Erase delmembers
  updated = False
  ' *** Get members in the group and create a list of the ones to keep
  members = doc.GetItemValue("Members")
  nmcnt = 0
  Forall m In members
   Set user = New NotesName(m)  
   If Iselement(userlist(Fulltrim(user.Common))) = False Then
    ' User is not among the ones to delete
    newmembers(Fulltrim(user.Common)) = Fulltrim(m)
    nmcnt = nmcnt + 1
   Else
    delmembers(Fulltrim(user.Common)) = Fulltrim(m)
    updated = True
   End If
  End Forall
  ' *** Build array of members to keep
  Redim newarray(nmcnt) As String
  nmcnt = 0
  Forall nm In newmembers
   newarray(nmcnt) = nm
   nmcnt = nmcnt + 1
  End Forall
  ' *** Write array of new members back to document and save it
  If updated = True Then
   Call doc.ReplaceItemValue("Members", Fulltrim(newarray))
   Call doc.Save(True,False)
   Print "Updating " & doc.GetItemValue("Listname")(0)
  End If
  Forall dm In delmembers
   removelog(doc.GetItemValue("Listname")(0)) = removelog(doc.GetItemValue("Listname")(0)) & dm & ";"
  End Forall
  Set doc = view.GetNextDocument(doc)
 Loop
 ' *** We are all done
 mailtext = ""
 Forall rl In removelog
  Call uidoc.FieldAppendText("LogResult", "Group '" & Listtag(rl) & "':" & Chr$(10))
  mailtext = mailtext & "Group '" & Listtag(rl) & "':" & Chr$(10)
  userarr = Split(Cstr(rl),";")
  Forall u In userarr
   Set user = New NotesName(u)     
   Call uidoc.FieldAppendText("LogResult", user.Common & Chr$(10))
   mailtext = mailtext & user.Common & Chr$(10)
  End Forall
 ' Call uidoc.FieldAppendText("LogResult", Chr$(10))
 End Forall
 Set mail = New NotesMail()
 mail.MailTo = session.CommonUserName
 mail.Subject = "[Notification] - Users removed from NAB"
 Call mail.AppendText(mailtext)
 mail.Principal = "IT Programs"
 Call mail.Send()
 Msgbox "Done removing specified user(s) from Domino Directory.",64,"Finished"
End Sub  

 

 



---------------------
http://www.bleedyellow.com/blogs/texasswede/entry/cleangroupsfromuser
Jan 03, 2012
19 hits



Recent Blog Posts
54


Gone fishing. Or rather gone scuba diving.
Sat, Nov 22nd 2014 1:05p   Karl-Henry Martinsson
I am currently away for a little over a week, taking a vacation in Curaçao. So no technical writing for a little bit. See you in December. [read] Keywords:
130


Free Code – Class to read URL name-value pairs
Thu, Nov 20th 2014 10:28a   Karl-Henry Martinsson
Here is another little code snippet I want to share. I use it all the time in my Lotusscript-based Domino web agents, and I figured that other could benefit from it as well. It is just an easy way to check for and read the name-value pairs (arguments) passed from the browser to the web […] [read] Keywords: domino lotusscript development
126


Verizon and AT&T are tracking all your online activity
Fri, Oct 31st 2014 2:45p   Karl-Henry Martinsson
As you may have read lately, Verizon have implemented a system that adds an HTTP header item in all web communication that originates from mobile phones on their network. Each phone/user get their own unique ID, which is transmitted to every website being visited (except if SSL is used), no matter if you have privacy/anonymous surfing […] [read] Keywords: mobile network
225


Nokia is dead
Wed, Oct 22nd 2014 8:05a   Karl-Henry Martinsson
Microsoft is taking a page out of IBM’s playbook and is killing off the Nokia brand. Future models of the smart phones in the Lumia series will be named Microsoft Lumia. Last month the Nokia Lumia 735 and 830 were launched, and they will probably be the last phones branded as Nokia. The mobile division of Nokia will […] [read] Keywords: ibm microsoft mobile
79


October Community Webcast – Wednesday October 15
Mon, Oct 13th 2014 9:05a   Karl-Henry Martinsson
This Wednesday it is again time for the monthly ICS community webcast. This month’s guest speaker will be Luis Guirigay, IBM SME for Social, Mobile and Cloud. Below is the description of the webcast agenda. Never before has there been more opportunity for IBM Notes Domino Enterprises! Join Luis Guirigay to learn about the latest […] [read] Keywords: domino ibm lotusnotes notes community mobile
47


Microsoft skipping Windows 9 – jumps to Windows 10
Tue, Sep 30th 2014 12:40p   Karl-Henry Martinsson
Microsoft unveiled the next version of Windows at a press event in San Francisco today. Surprisingly the successor to Windows 8 and 8.1 will not be called Windows 9 as everyone expected. Instead Microsoft jumps straight to Windows 10. One reason for this, according to Microsoft, is that the new operating system is such a big leap […] [read] Keywords: microsoft




82


Free Software – Password Reset for Notes/Domino
Wed, Sep 24th 2014 12:41p   Karl-Henry Martinsson
Earlier this year I was asked to research some alternatives for a web-based password reset function at my work. One of the larger support burdens are users who forget the passwords, especially in the first few days after changing it. We have a 90 day password lifespan, then a new password need to be picked. Some […] [read] Keywords: domino notes notesdomino password
44


#ThrowbackThursday – Worst Practives at Connect 2013
Thu, Sep 18th 2014 6:05a   Karl-Henry Martinsson
Paul Mooney and Bill Buchan returns with a brand new Worst Practices at IBM Connect 2013. This session alone is almost worth the cost to attend Lotusphere/Connect/ConnectED. There is a slight skip towards the end, when I had to switch batteries. Otherwise you have the whole session, including the warm-up performance. [read] Keywords: ibm lotusphere
52


More on IBM ConnectED 2015
Wed, Sep 17th 2014 12:05p   Karl-Henry Martinsson
This morning Kristin Keene from IBM talked more about the upcoming IBM ConnectED 2015 in January at the ICS Community webcast. IBM realized that the last few years they been swinging over too much to the business side, and is now going back to a much more technical conference. As I mentioned the other day, […] [read] Keywords: ibm community
47


Survey about Notes and Domino directions
Tue, Sep 16th 2014 2:45p   Karl-Henry Martinsson
PSC is doing a community survey about the direction of IBM Notes and Domino. John Head, Director of Enterprise Collaboration at the Chicago-based consulting company PSC Group explains that it’s not about gathering data, the (optional) email address collected will only be used to notify about the result.PSC promises to share the full results publically. I […] [read] Keywords: collaboration domino ibm notes community consulting email enterprise




Created and Maintained by Yancy Lent - About - Blog Submission - Suggestions - Change Log - Blog Widget - Advertising - Mobile Edition