329 Lotus blogs updated hourly. Who will post next? Home | Downloads | Events | Jobs | Twitter | Bookmarks | Pods | Blogs | Search | myPL | About 
 
Latest 7 Posts
Lotus 1-2-3, SmartSuite and Organizer officially retired
Fri, May 17th 2013 195
Ender’s Game – First Movie Footage
Fri, May 3rd 2013 107
My recipes – All in one place
Mon, Apr 29th 2013 186
Useful utility to rename files in bulk
Tue, Apr 23rd 2013 138
The Enemy’s Gate is Down
Tue, Apr 16th 2013 240
How to set doctype on Notes forms
Thu, Apr 11th 2013 240
New LEGO Lord of The Rings sets this summer
Fri, Apr 5th 2013 287
Top 10
Review: Samsung Galaxy S3
Sun, Jun 24th 2012 2560
Code: Expanded Class for File Functions
Fri, Dec 21st 2012 780
Create and update Calendar reminders from Notes document
Thu, Aug 11th 2011 767
Code: Simple class for parsing file names
Thu, Dec 20th 2012 765
Creating PDF files from Notes documents
Thu, Nov 11th 2010 718
IBM Notes and Domino 9.0 Social Edition
Tue, Nov 13th 2012 686
Free Tool: Analyze ACL in Notes Application/Database
Tue, Nov 15th 2011 656
Export from Notes to Excel – 3 different ways
Wed, Nov 14th 2012 636
IBM Notes & Domino 9.0 Social Edition – Public beta now available!
Thu, Dec 13th 2012 611
How to write better code in Domino Designer – Part 1
Wed, Feb 20th 2013 577


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



Recent Blog Posts
195


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 ibm lotus notes microsoft office properties
107


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:
186


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:
138


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
240


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
240


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 ibm lotusnotes notes database development firefox javascript twitter




287


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:
564


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! %REM Agent View Export Created Mar 27, 2013 by Karl-Henry Martinsson Description: Code to export a [read] Keywords: agent lotus lotusscript notes database server
487


Should everyone be a programmer?
Tue, Apr 2nd 2013 2:47p   Karl-Henry Martinsson
For years, there has been a debate if anyone can (or should) learn programming or not. While reading the Notes and Javascript groups on LinkedIn, as well as the Notes forums on IBM developerWorks, I have read more than one post where someone wants to learn Javascript or Notes programming, but don’t have any programming experience/knowledge. Can anyone learn to program? No. I would say half the population could learn at least the basics and mechanics of programming.  So should everyon [read] Keywords: atlas domino formula language ibm lotus lotusscript notes ajax community css facebook java javascript linkedin wiki xml
229


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 ibm lotusnotes notes notes client workspace




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