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:
'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.
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
' *** 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)
' *** 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)
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
delmembers(Fulltrim(user.Common)) = Fulltrim(m)
updated = True
' *** Build array of members to keep
Redim newarray(nmcnt) As String
nmcnt = 0
Forall nm In newmembers
newarray(nmcnt) = nm
nmcnt = nmcnt + 1
' *** Write array of new members back to document and save it
If updated = True Then
Call doc.ReplaceItemValue("Members", Fulltrim(newarray))
Print "Updating " & doc.GetItemValue("Listname")(0)
Forall dm In delmembers
removelog(doc.GetItemValue("Listname")(0)) = removelog(doc.GetItemValue("Listname")(0)) & dm & ";"
Set doc = view.GetNextDocument(doc)
' *** 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)
' Call uidoc.FieldAppendText("LogResult", Chr$(10))
Set mail = New NotesMail()
mail.MailTo = session.CommonUserName
mail.Subject = "[Notification] - Users removed from NAB"
mail.Principal = "IT Programs"
Msgbox "Done removing specified user(s) from Domino Directory.",64,"Finished"
Lotus 1-2-3, SmartSuite and Organizer officially retired
Fri, May 17th 2013 6:50a Karl-Henry Martinsson Earlier this week, IBM announced the withdrawal of marketing [sic!] of Lotus 1-2-3, together with Lotus SmartSuite and Lotus Organizer, effective 06/11/2013. Support ends on 09/30/2014.
Lotus 1-2-3 version 3.0 for MS/DOS
I personally never worked with 1-2-3 myself. When I started with computers in school, we used CP/M-86 as the operating system, and had a spreadsheet program developed specifically for use in the Swedish schools. My first job after high school was with Microsoft in 1988, so my fi [read] Keywords: formula language
Ender’s Game – First Movie Footage
Fri, May 3rd 2013 1:45p Karl-Henry Martinsson Preview for the teaser trailer, to be released on May 7.
You get to see about 10 seconds of movie footage here, and I have to say it looks pretty good to me. [read] Keywords:
My recipes – All in one place
Mon, Apr 29th 2013 11:06a Karl-Henry Martinsson For many years, I have enjoyed cooking and baking. One reason could be because I like good food. But it is also logical, similar to programming. You have instructions you follow, but you can still modify them, as long as you know how different ingredients react with each other and with heat, liquids, etc. Cooking is a combination of programming, chemistry and physics. Perfect for a geek!
I often get questions about how I made a particular dish. Many of the recipes have been published on my blog, [read] Keywords:
Useful utility to rename files in bulk
Tue, Apr 23rd 2013 3:20p Karl-Henry Martinsson Earlier today I had to rename about 400 image files, and I was looking for a convenient tool that would help me out. I had to remove part of the filename, in the middle of the filename, which was a bit tricky.
I found a very useful tool, called Bulk Rename Utility. It does not have the most user-friendly interface, but it is very powerful. And the best thing is that it is free. You can download it here.
This is the somewhat messy but very powerful user interface… [read] Keywords: interface
The Enemy’s Gate is Down
Tue, Apr 16th 2013 5:04p Karl-Henry Martinsson Teaser poster for the upcoming movie adaptation of Orson Scott Card’s book Ender’s Game. I really enjoyed the book (as well as the parallel story in Ender’s Shadow), and hope the movie will stay at least somewhat close to the story in the books. According to the author, the movie will use elements from both books.
If you haven’t read the books, I can highly recommend them. [read] Keywords: wiki
How to set doctype on Notes forms
Thu, Apr 11th 2013 1:29p Karl-Henry Martinsson Who redesigning my website to use Bootstrap, I ran into a problem. The navbar (meny) did not render correctly in Internet Explorer 9, despite looking perfect in Firefox and Internet Explorer 10. There are several discussions about this problem on StackOverflow and other forums, and the solution is simply to add on the first line of the HTML code.
However, IBM Domino automatically adds a different doctype string, and there is no database or form property to change/set the correct value. But ther [read] Keywords: domino
New LEGO Lord of The Rings sets this summer
Fri, Apr 5th 2013 1:51p Karl-Henry Martinsson As the regular reader of this blog may have noticed, I am a huge Lord of the Rings fan, and I also enjoy building LEGO. There are four new LEGO sets in the Lord of The Rings series to be released this summer (in June, according to TheBrickBlogger.com). They are:
79005 – The Wizard Battle, 113 pieces, $12.99
79006 – The Council of Elrond, 243 pieces, $29.99
79007 – Battle at the Black Gate , 656 pieces, $59.99
79008 – Pirate Ship Ambush, 756 pieces, $99.99
Pictures below from The [read] Keywords:
Export Notes view to Excel – with multi-value fields
Fri, Apr 5th 2013 9:26a Karl-Henry Martinsson A few days ago, a question was asked on StackOverflow about how to export the content of a Notes view to Excel. The caveat was that some columns contained multiple values, but not on all documents.
To solve this, I wrote a Lotusscript class that will export view data as either CSV or as an HTML table, both can then be saved to a file and opened in Excel. I am posting the code below. Enjoy!
Agent View Export
Created Mar 27, 2013 by Karl-Henry Martinsson
Description: Code to export a [read] Keywords: agent
And I am up and running!
Thu, Mar 21st 2013 12:45p Karl-Henry Martinsson Downloaded the Notes client with Domino Designer and Administrator, installed it on top of the public beta from December in a viritual machine (with 1GB memory). Install went without any problems, and the client starts up fine. All settings and bookmarks were preserved from the beta.
My workspace in IBM Notes 9.0 Social Edition
It just works. [read] Keywords: domino