Manage Learn to apply best practices and optimize your operations.

Need To See Who Has Profile Documents And What They Contain?

As profile documents do not appear in views, it can be difficult to find out
whether a user has a profile, or what settings or field values users have
stored in their profiles. This agent creates a summary document of all user
profiles, based on the database ACL. It will drill through 9 levels of nested
groups, which should be more that enough when you consider that Lotus recommend
6 at most.

As the process of checking a profile creates a profile, documents newly created
are removed.

If you want to use the code, copy from the first "Dim" statement to the
"*****************************************" line into the (Declarations)
section of a new Script Library called "Process People from ACL", and put the
rest into an agent.
Script Library Name: "Process People from ACL"

Dim S As NotesSession ' Contains the Database
Dim DB As NotesDatabase ' Current Database
Dim NAB As NotesDatabase ' Name & Address Book
Dim ACL As NotesACL ' Current DB ACL
Dim ACLEntry As NotesACLEntry ' For each ACL Entry
Dim Doc As NotesDocument ' All Profile data is written
to this document
Dim Profile As NotesDocument ' Profile document
Dim NABDoc As NotesDocument ' Either a Group, server or
person document
Dim View As NotesView ' ($Users) View in NAB
Dim ProfileUserName() As String ' Array to store the name
of the profile owners
Dim ProfileDeputy() As String ' Array to store profile
owner's deputy
Dim ProfileExt() As String ' Array to store
profile owner's phone ext.
Dim GroupMembers As Variant ' }
Dim L1GroupMembers As Variant ' }
Dim L2GroupMembers As Variant ' }
Dim L3GroupMembers As Variant ' }
Dim L4GroupMembers As Variant ' } Arrays to store the value
of the Members field from group documents in NAB
Dim L5GroupMembers As Variant ' }
Dim L6GroupMembers As Variant ' }
Dim L7GroupMembers As Variant ' }
Dim L8GroupMembers As Variant ' }

Function ProcessPerson(DB As Notesdatabase, ProfileDetails As NotesDocument,
ProfileName As Variant)
' Declare and get/create the profile document
Dim Profile As NotesDocument
Set Profile = DB.GetProfileDocument("Profile", ProfileName)
' Check to see if it a new or existing Profile.
' If it has just been created, it will not have the PhoneExt field so we
can ignore it
If Profile.HasItem("PhoneExt") Then
' Check to see if the profile owner has already been added to the
list. The user may appear in many groups
Forall p In ProfileUserName
If Profile.Name(0) = p Then Exit Function
End Forall
' Get the current blank position within the array
x = (Ubound(ProfileUserName))
' Write the values from the Profile document
ProfileUserName(x) =
ProfileDeputy(x) = Profile.Deputies(0)
ProfileExt(x) = Profile.PhoneExt(0)
' Redim the arrays prior to next addition
Redim Preserve ProfileUserName(x + 1)
Redim Preserve ProfileDeputy(x + 1)
Redim Preserve ProfileExt(x + 1)
' If the profile is a new document, we do not need to keep it
Call Profile.Remove(True)
End If
End Function

Function ProcessGroup(View As NotesView, GroupMembers As Variant)
' Dimension the Level 0 document. Used to contain the document returned
by each lookup to the NAB
Dim L0PABDoc As NotesDocument
' GroupMembers could be Person names or Group names. The View contains
' Need to step through each, check to see if it is a Person doc and
process accordingly
Forall M In GroupMembers
' Get the document from the ($Users) view in NAB
Set L0PABDoc = View.GetDocumentByKey(M, True)
' Check to see that a document has been returned
If Not L0PABDoc Is Nothing Then
' Check the document Type. Either "Group" or "Person"
If L0PABDoc.Type(0) = "Group" Then
' Get the value of the "Members" field and pass it as an
arguement to next level down and repeat the process
L1GroupMembers = L0PABDoc.GetItemValue("Members")
Call ProcessL1Group(View, L1GroupMembers)
' Pass details to the "ProcessPerson" function
Call ProcessPerson(DB, Doc, L0PABDoc.FullName(0))
End If
End If
End Forall

Dig Deeper on Domino Resources - Part 6



  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/ community. These cheat ...

  • HTML cheat sheet

    This is a really cool cheat sheet if you're looking to learn more about HTML. You'll find just about everything you every wanted ...

  • Carol Woodbury: Security

    Carol Woodbury