Manage Learn to apply best practices and optimize your operations.

Verify Nab Group Members To Gab

Hard time keeping your NAB Group members in sync with actual users?
This script runs through each NAB Group member and verifies it to the Global
Address Book. It adds the "not found" members to a field called "BadNames",
which you must create on the Group form in the NAB (editable, text). It then
sends a memo to whoever is listed at the end of the script, identifying the
Groups containing BadNames and adds a doclink for each.
Change GAB Replica ID, Search (if required) and addresses for the e-mail.
Sub Initialize

Dim Session As New NotesSession
Dim db As notesdatabase
Dim doc As notesdocument
Dim Summary As Notesdocument
Dim Collection As NotesDocumentCollection
Dim CutOff As NotesDateTime
Dim BadNames As String
Dim n As Integer
Set cuffoff = New NotesDateTime("1901/01/01")

nablookup:
Dim dbNAB As New NotesDatabase ( "","")
Dim dbNABGroup As NotesDatabase
Set dbNABGroup = session.CurrentDatabase
' **** Set the name of the GAB database ****
' **** Replace XXXX with rep ID ****
Call dbNab.OpenByReplicaID( "", "XXXX")

Dim viewNAB As NotesView
Dim viewNabGroup As Notesview
Set viewNAB = dbNAB.GetView("($VIMPeople)")
Set viewNABGroup = dbNABGroup.GetView("($VIMGroups)")

okay:
Set db = Session.currentdatabase

' **** Select the collection of Group documents ****
Search$="FORM="+"""" +"Group"+""""
Print "Collecting The Groups"
Set Collection=db.search(Search$,CutOff,0)
Set doc = Collection.getfirstdocument

While Not (doc Is Nothing)
n=0
doc.BadNames = ""
Call doc.Save(False, True)

' **** Pull Member name, one at a time, and verify to the GAB ****
Forall members In doc.members
Dim NameText As New NotesName(doc.Members(n))
' **** Look for Non Groups ***
Dim subString As String
subString$ = Right$(NameText.Abbreviated, 13)
' **** change XXXX as per your mail
If subString$ = "XXXX" Then
Set docNAB = viewNAB.GetDocumentByKey(NameText.Abbreviated)

' **** If no entry in GAB Name view, add name to BadNames
in the Group doc ****
If docNAB Is Nothing Then
Print doc.Members(n) & " not located in GAB"
Dim item As NotesItem
Set item= doc.GetFirstItem("BadNames")
Call item.AppendToTextList(doc.Members(n))
Call doc.Save(False, True)
End If
End If
' **** change XXXX as per your mail
If subString$ <> "XXXX" Then
Set docNAB = viewNABGroup.GetDocumentByKey(NameText.Common)

' **** If no entry in NAB Group view, add name to BadNames
in the Group doc ****
If docNAB Is Nothing Then
Print doc.Members(n) & " not located in NAB"
Set item= doc.GetFirstItem("BadNames")
Call item.AppendToTextList(doc.Members(n))
Call doc.Save(False, True)
End If
End If


n=n+1
End Forall

' **** Go to next document in collection ****
Set doc=Collection.GetNextDocument(doc)
Wend

newsletter:
Dim dc As NotesDocumentCollection
Dim news As NotesNewsletter

' **** Select the collection of all Group docs with Bad Names ****
Search$="FORM="+""""+"Group"+""""+" & BadNames<>"+""""+""""
Print "Collecting The BAD Groups"
Set dc=db.search(Search$,CutOff,0)

' **** Create the newsletter on the Summary form with doclinks ****
Set news = New NotesNewsletter(dc)
news.SubjectItemName = "ListName"
news.DoSubject = True

Set doc = news.FormatMsgWithDoclinks( db )
doc.Form = "Summary"
' **** Change Addressee(s) below as required, either individuals or a
group****
Call doc.Send(True, "ADMINISTRATORS")
Call doc.Send(True, "Tony Price/GroupSvc/USERS/TDGROUP")
End Sub

Dig Deeper on Lotus Domino Directory

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close