357 Lotus blogs updated hourly. Who will post next? Home | Downloads | Events | Pods | Blogs | Search | myPL | About 
 
Latest 7 Posts
ConnectED 2015 – Smaller and shorter but more technical
Thu, Jul 24th 2014 93
Recover lost SSL keyring password
Thu, Jul 24th 2014 59
IBM Connect becomes IBM ConnectED in 2015
Wed, Jul 23rd 2014 318
Code snippet – DateClass
Mon, Jul 21st 2014 144
I am back.
Mon, Jul 21st 2014 178
Things we don’t want to think about
Thu, May 15th 2014 424
In memory of Tim Tripcony
Mon, May 12th 2014 538
Top 10
Pool party or no pool party, that is the question – or is it?
Mon, Jan 13th 2014 1377
Export Notes view to Excel – with multi-value fields
Fri, Apr 5th 2013 827
Export from Notes to Excel – 3 different ways
Wed, Nov 14th 2012 574
Free Tool: Analyze ACL in Notes Application/Database
Tue, Nov 15th 2011 569
In memory of Tim Tripcony
Mon, May 12th 2014 538
Create and update Calendar reminders from Notes document
Thu, Aug 11th 2011 528
Code snippet – jQuery
Sat, Mar 15th 2014 497
jQuery – An Overview
Fri, Jul 19th 2013 491
Things we don’t want to think about
Thu, May 15th 2014 424
Connect 2014 – Day 0 (Saturday)
Mon, Jan 27th 2014 399


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
130 hits



Recent Blog Posts
93


ConnectED 2015 – Smaller and shorter but more technical
Thu, Jul 24th 2014 1:40p   Karl-Henry Martinsson
If you read the official IBM announcment for ConnectED 2015 posted by Mat Newman, you will notice a few interesting details. First of all, the event is shorter than previous years. It starts on Sunday and ends on Wednesday instead of Thursday. On Sunday IBM has scheduled the Leadership Alliance meeting, which previously been held in […] [read] Keywords: ibm
59


Recover lost SSL keyring password
Thu, Jul 24th 2014 10:45a   Karl-Henry Martinsson
About two years ago, our Network (as well as Domino) administrator left the company after 10 years. The other day our SSL certificate for one of our websites expired, and we wanted to use a newer wildcard certificate instead of a server specific certificate. The problem was that we did not have the password for […] [read] Keywords: domino lotus network password server
318


IBM Connect becomes IBM ConnectED in 2015
Wed, Jul 23rd 2014 12:25p   Karl-Henry Martinsson
IBM has announced the new name for the yearly conference in Orlando, the one most of us know (and still call) Lotusphere. For the last two years it was named Connect, and for 2015 IBM again changes the name, this time to ConnectED. The conference will be more technical than the last few years, according […] [read] Keywords: ibm lotusphere
144


Code snippet – DateClass
Mon, Jul 21st 2014 6:45p   Karl-Henry Martinsson
Here is a small Lotusscript class I wrote some years ago. I use it in a number of other classes where I need to use date functionality of different kind. For example, I have a class that communicates with a FoxPro database, using a COM object. Some of the methods in that class uses XML while […] [read] Keywords: domino lotusscript database xml
178


I am back.
Mon, Jul 21st 2014 5:25p   Karl-Henry Martinsson
On June 11 I had some major surgery at Medical City in Dallas. It was a planned surgery to remove part of my intestines to prevent future outbreaks of diverticulitis. I been having about 2-3 outbreaks a year for the last 12 years or so. Normally they perform surgery after just 2 severe cases. I was not […] [read] Keywords:
424


Things we don’t want to think about
Thu, May 15th 2014 8:48a   Karl-Henry Martinsson
Two separate incidents are leading me to write this blog entry. First, the way too early passing of Tim Tripcony just a few days ago, as well as as the loss of Rob Wunderlich, Jens Augustiny and Kenneth Kjærbye in just a little over a year. All of those members of the Lotus Community left us way […] [read] Keywords: lotus community
538


In memory of Tim Tripcony
Mon, May 12th 2014 8:15p   Karl-Henry Martinsson
A couple of hours ago, I was reached by the terrible news that Tim Tripcony is no longer with us. I have known Tim for several years, and meeting him at Lotusphere (later Connect) was always a treat. He is one of the most brilliant programmers I have met, and he always had time to talk […] [read] Keywords: ibm lotusphere
273


Code snippet – Disable agent using external file
Thu, May 1st 2014 9:24p   Karl-Henry Martinsson
Yesterday I was asked to create a system that would let us disable agents running on a Domino server in an easy way, before the Domino server comes back from a crash. For a while we have been having one particular agent crash, taking the whole Domino server down with it. It only happens occasionally, and seems to be related to the document being processed. When the server comes up after a crash like that, a consistence check is done, then the agent manager launches the agent again, causing th [read] Keywords: agent domino script library server




497


Code snippet – jQuery
Sat, Mar 15th 2014 11:43a   Karl-Henry Martinsson
This morning I was working on a web application, and I came up with a pretty neat and simple little solution. So I just wanted to share it, in case anyone else need something similar. I have a webpage with an HTML form. Each input tag has an attribute called notesfield, matching the name of the field in Notes where the value is stored: First Name Initial Last Name Then I created a simple function that will call an agent on the Domino server, which will return all th [read] Keywords: agent domino notes ajax application database server
285


World Wide Web turning 25 years this week
Fri, Mar 14th 2014 3:02p   Karl-Henry Martinsson
In some articles it is claimed that Internet turns 25 years old this week, which of course is not true. But the World Wide Web is. It was on March 12, 1989 that Tim Berners-Lee wrote a proposal for a hypertext system that would become what we call “the web”. In 1991 the first webpage was created and published at CERN. Since then the web has exploded. I first got in touch with web pages and HTML in 1994, and in 1995 I had my own little server running on my work computer. I don’t [read] Keywords: lotus notes ajax development email google instant messaging javascript network server wiki wireless




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