Need to update Script Library properties for many Mail files

We found out that when users selected to add Webex functionality in to Lotus Notes, WebEX modified the Appointment form, as well as these four Script Libraries:CSCalendarEntry

CSEventClass

CSEventNotes

CSUIViewClass

I started here but wasn’t sure if I was on the right track and if so where to go with the code:

Dim nc As NotesNoteCollection

Set nc = db.CreateNoteCollection(False)

Call nc.SelectAllCodeElements(True)

nc.SelectScriptLibraries = True

Call nc.BuildCollection

Edit to add…

OK, getting further, just need to add the “OR” statement for the other script library’s and figure out the Form Property and I should be good to go.

Dim session As New NotesSession

Dim db As NotesDatabase

Dim form As NotesForm

Set db = session.CurrentDatabase	



Set form = db.GetForm("Appointment")

'If form.IsProhibitDesignRefresh Then

	'form.IsProhibitDesignRefresh = False  

'End If



Dim nc As NotesNoteCollection

Set nc = db.CreateNoteCollection(False)

Call nc.SelectAllCodeElements(True)

nc.SelectScriptLibraries = True

nc.SelectAgents = False

nc.SelectDatabaseScript = False

nc.SelectDataConnections = False

nc.SelectMiscCodeElements = False	

nc.SelectOutlines = False

Call nc.BuildCollection



If (nc.Count > 0) Then

	Dim nid As String

	nid = nc.GetFirstNoteId()

	Dim designNote As NotesDocument

	Dim posP As Integer

	Dim curFlags As String

	Dim newFlags As String

	Dim DesignName As String

	While (Not nid = "")

		Set designNote = db.GetDocumentByID(nid)

		DesignName= designNote.GetItemValue( "$TITLE")(0)

		If DesignName = "CSCalendarEntry" Then

			curFlags = designNote.GetItemValue("$Flags")(0)

			posP = Instr(curFlags, "P")

			If (posP > 0) Then

				newFlags = Join(Split(curFlags, "P"))

				Call designNote.ReplaceItemValue("$Flags", newFlags)

				Call designNote.Save(False, True)

			End If

		End If

		

		nid = nc.GetNextNoteId(nid)

	Wend

End If

Shane Meisner

Subject: Getting there… Tomorrow we test

In case anyone else needs to do this I’ll try to add the code as I go… Not very pretty as I am basically jsut copying & pasting now for testing…:

Sub Click(Source As Button)

Dim session As New NotesSession

Dim db As NotesDatabase

Dim form As NotesForm

Dim item As NotesItem



Dim designNote As NotesDocument

Dim posP As Integer

Dim curFlags As String

Dim newFlags As String

Dim DesignName As String

Dim nid As String



Set db = session.CurrentDatabase	



Set form = db.GetForm("Appointment")



Dim nc As NotesNoteCollection

Set nc = db.CreateNoteCollection(False)



''''' Update the Appointment Form ''''''''



Call nc.SelectAllFormatElements(True)

nc.SelectForms = True

nc.SelectActions = False

nc.SelectFrameSets = False

nc.SelectImageResources = False

nc.SelectJavaResources = False

nc.SelectMiscFormatElements= False

nc.SelectPages = False

nc.SelectStyleSheetResources = False

nc.SelectSubforms = False



If (nc.Count > 0) Then		

	nid = nc.GetFirstNoteId()		

	While (Not nid = "")

		Set designNote = db.GetDocumentByID(nid)

		DesignName= designNote.GetItemValue( "$TITLE")(0)

		If DesignName = "Appointment" Then

			curFlags = designNote.GetItemValue("$Flags")(0)

			posP = Instr(curFlags, "P")

			If (posP > 0) Then

				newFlags = Join(Split(curFlags, "P"))

				Call designNote.ReplaceItemValue("$Flags", newFlags)

				Call designNote.Save(False, True)

			End If

		End If			

		nid = nc.GetNextNoteId(nid)

	Wend

End If



''''Update the Script Libraries'''''''



Call nc.SelectAllCodeElements(True)

nc.SelectScriptLibraries = True

nc.SelectAgents = False

nc.SelectDatabaseScript = False

nc.SelectDataConnections = False

nc.SelectMiscCodeElements = False	

nc.SelectOutlines = False

Call nc.BuildCollection



If (nc.Count > 0) Then		

	nid = nc.GetFirstNoteId()		

	While (Not nid = "")

		Set designNote = db.GetDocumentByID(nid)

		DesignName= designNote.GetItemValue( "$TITLE")(0)

		If DesignName = "CSCalendarEntry" Then

			curFlags = designNote.GetItemValue("$Flags")(0)

			posP = Instr(curFlags, "P")

			If (posP > 0) Then

				newFlags = Join(Split(curFlags, "P"))

				Call designNote.ReplaceItemValue("$Flags", newFlags)

				Call designNote.Save(False, True)

			End If

		End If			

		nid = nc.GetNextNoteId(nid)

	Wend

End If

End Sub