Manage Learn to apply best practices and optimize your operations.

Uncheck Icon Refresh Replace Design Via Script

This script will uncheck the refresh/replace design updates box on the icon.

The next time the mail template changes, the design task will then replace all the icons to the one that is in the mail template. I added an agent to the "mail tools" download from notes.net. I also used a tip on how to access design elements, also on notes.net


The DBDesign Script lib must be included (download the "LotusScript DatabaseDesign Class" from the sandbox and copy it. Then, download the "Mail File Tool". Add the following agent...

Option Public
Use "DBDesign"

Sub Initialize
Dim dbDir As New NotesDbDirectory( "" )
Dim agentlog As NotesLog
Dim count As Integer
Dim howmany As String
Dim session As New NotesSession
Dim state As String
Dim range As String

Set db = session.CurrentDatabase
Set agent = session.CurrentAgent
count = 0
Set agentlog = New NotesLog(agent.Name + " Agent in " + db.Title + " on " + db.Server )
Call agentlog.OpenNotesLog( db.Server , db.FilePath )
Call agentlog.LogAction(agent.Name + " Agent starting." )
Dim curdb As NotesDatabase
Dim level As Integer
Set curdb = dbDir.GetFirstDatabase(DATABASE)
While Not(curdb Is Nothing)
path$ = Ucase(curdb.FilePath)
pos = Instr(path$, "MAIL") 'Do not use or / due to different server types.
If pos = 1 Then
count = count + 1
On Error Goto processError
If curdb.DesignTemplateName = "" Then
Call agentlog.LogAction ( "DESIGN: " & Cstr(count) & " " & curdb.FileName & " has no inherit_design_from value.")
Else
Call agentlog.LogAction ( "DESIGN: " & Cstr(count) & " " & curdb.FileName & " " & curdb.DesignTemplateName )
End If
Call curdb.Open( "", "" )
level = curdb.CurrentAccessLevel

Print curdb.Title

If level < ACLLEVEL_EDITOR Then
Print Cstr(count) & " " & curdb.FileName & " " & curdb.Title & " skipped due to Access Level " & Cstr(level)
Call agentlog.LogAction ( "LISTMF: " & Cstr(count) & " " & curdb.FileName & " " & curdb.Title & " skipped due to Access Level " & Cstr(level))
Else
If curdb.IsOpen Then
Call UncheckIconReplaceRefresh(curdb, agentlog, count)
Call curdb.Close
End If
End If
End If
nextdb:
Set curdb = dbDir.GetNextDatabase
Wend
If count = 0 Then
howmany = "There were no mail file databases checked."
Else
If count = 1 Then
howmany = "One mail file database checked."
Else
howmany = "There were " & count & " mail file databases checked."
End If
End If
Call agentlog.LogAction ( howmany )
Call agentlog.LogAction(agent.Name + " Agent ending." )
Call agentlog.Close
Exit Sub
processError:
Call agentlog.LogAction ( curdb.Title & " raised error: " & Err() & ": " & Error())
Resume nextdb
End Sub

Sub UncheckIconReplaceRefresh(db As NotesDatabase, agentlog As NotesLog, count As Integer)
Dim dbdesign As DatabaseDesign
Set dbDesign = createDatabaseDesign( db)

Dim icons As Variant
Dim flagValue As String
Dim position As Integer

icons = dbdesign.iconDocuments
Forall i In icons
flagValue = i.getItemValue( "$Flags")(0)
position = Instr(1, flagValue, "R")
If position = 0 Then
flagValue = flagValue & "R"
Call i.ReplaceItemValue( "$Flags", flagValue )
Call i.Save( True, True )
Call agentlog.LogAction ( "ICON: " & Cstr(count) & {" Icon has been set to have design replaced.} )
Else
Call agentlog.LogAction ( "ICON: " & Cstr(count) & {" Replace design already set.} )
End If
End Forall
End Sub

Dig Deeper on Domino Resources - Part 4

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