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
GetLevelConstant は、文字列を対応する定数に変換します (例えば、"設計者" を 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