Sub Initialize Dim ss As New NotesSession Dim acl As NotesACL Dim entry As NotesACLEntry Dim nam As NotesName '階層名を省略形にするために利用 Dim admin As String '宛先を格納する変数 Dim ws As New NotesUIWorkspace Dim db As New NotesDatabase( "", "" ) Dim uidoc As NotesUIDocument 'ACLエントリに特定のロールが付与されている場合、宛先へ追加する admin = "" Set acl = ss.CurrentDatabase.ACL Set entry = acl.GetFirstEntry While Not ( entry Is Nothing ) If Not Isnull( Arraygetindex( entry.Roles, "[Admin]", 0 ) ) Then Set nam = New NotesName( entry.Name ) admin = admin & nam.Abbreviated & ", " End If Set entry = acl.GetNextEntry( entry ) Wend 'メール作成画面を開き、宛先をセットする Call db.OpenMail Set uidoc = ws.ComposeDocument( db.Server, db.FilePath, "Memo" ) Call uidoc.GotoField( "EnterSendTo" ) Call uidoc.InsertText( admin ) End Sub
これはサンプルなので手抜きですが、実際にはサーバーやサーバーグループのような不要なエントリを外したり、宛先フィールドのサイズ制限を考慮した仕組みが欲しくなるかと思います。
0 件のコメント:
コメントを投稿