Examples: Name property (NotesACLEntry - LotusScript®)
- This script gets the name of the first entry of the access control
list of the current database, and puts it into the variable entryName.
For example, Name might return "- Default -."
Dim session As New NotesSession Dim db As NotesDatabase Dim acl As NotesACL Dim entry As NotesACLEntry Dim entryName As String Set db = session.CurrentDatabase Set acl = db.ACL Set entry = acl.GetFirstEntry entryName = entry.Name
- This button script prompts the user for an access level, and then
places the names of entries with that access level into the People
field on the current document. For example, if the user enters "Designer,"
and Sharron Karasic and Brandon Giles have Designer access to the
current database, the script places "Sharron Karasic" and "Brandon
Giles" into the People field. If the user enters an invalid access
level, or if there are no entries at that access level, the People
field remains unchanged.
The GetLevelConstant sub converts a string, such as "Designer," into the corresponding constant, such as ACLLEVEL_DESIGNER.
Sub Click(Source As Button) Dim workspace As New NotesUIWorkspace Dim uidoc As NotesUIDocument Dim session As New NotesSession Dim db As NotesDatabase Dim acl As NotesACL Dim entry As NotesACLEntry Dim levelString As String Dim levelConstant As Integer Set uidoc = workspace.CurrentDocument Set db = session.CurrentDatabase Set acl = db.ACL levelString = Inputbox$( "What level?" ) ' function call to convert the string ' into an ACLLEVEL constant levelConstant = GetLevelConstant( levelString ) ' go through all the entries in the ACL Set entry = acl.GetFirstEntry While Not ( entry Is Nothing ) ' if the entry has the level that the user chose If ( entry.Level = levelConstant ) Then ' append the entry's name to the text list ' in the People field Call uidoc.FieldAppendText _ ( "People", entry.Name & "; " ) End If Set entry = acl.GetNextEntry( entry ) Wend ' refresh current document so that ' text list displays nicely Call uidoc.Refresh End Sub Function GetLevelConstant( desiredLevel As String ) Dim levelConstant As Integer Select Case desiredLevel Case "Manager": levelConstant = ACLLEVEL_MANAGER Case "Designer": levelConstant = ACLLEVEL_DESIGNER Case "Editor": levelConstant = ACLLEVEL_EDITOR Case "Author": levelConstant = ACLLEVEL_AUTHOR Case "Reader": levelConstant = ACLLEVEL_READER Case "No Access": levelConstant = ACLLEVEL_NOACCESS End Select GetLevelConstant = levelConstant End Function