Changing Private Views & Folders to Shared on Selected Target Server Database Files

Have you ever had a situation where you want to move databases from server A to server B by doing the following:
1. Create replicas of databases from server A on server B
2. Remove databases from server A.

The problem with this approach is if there's private folders/views used in the databases they will not be replicated across as they are stored in the user's respective desktop.dsk file.

To get around this problem I have written some LS code that changes private views and folders to shared for specified databases on a specified server. The new shared views and folders will be replicated successfully from Server A to Server B.

The LS code should be placed in the Initialize subroutine in a scheduled agent to run from the Public Name and Address Book database and run with the appropriate permissions to modify selected target server's database files.

Sub initialize
1. Place this LS CODE into an Initialize Subroutine in a scheduled agent running from the Public Name and Address Book.
2. Specify the server name in the 3rd line of code.

Dim db As NotesDatabase Dim doc As NotesDocument Dim dbdir As New NotesDbDirectory("SERVER01") 'specify domino server here
Dim View As NotesView
Dim DeleteView As NotesView
Dim OriginalView As String
Dim doccounta, doccountb As Integer

Set db = dbdir.GetFirstDatabase(DATABASE)

While Not(db Is Nothing)
'specify database file type here - in this case mail database or use * for every type
If db.FilePath Like "mail*" Then
Print "Processing database: " + db.FilePath
' process thru array of views and folders
Forall Views In db.Views
Set View = Views
' identify private view/folder
If Not Isempty(View.Readers) Then
Doccounta = 1
OriginalView = View.Name
Print "Found Private View or Folder: " + OriginalView Set DeleteView = View
Set Doc= View.GetFirstDocument

' place private folder documents into temporary folder While Not Doc Is Nothing Print "Please wait, copying Doc:
Call Doc.PutInFolder( "FolderTemp" )
Set Doc= View.GetNextDocument(Doc)
Doccounta = Doccounta + 1

' delete private folder
If Not DeleteView Is Nothing
Then Call DeleteView.Remove
End If

Doccountb = 1
Set View = db.GetView("FolderTemp")
If Not View Is Nothing Then
Set Doc= View.GetFirstDocument

' recreate private folder as shared and populate with docs from temporary folder
While Not Doc Is Nothing
Print "Please wait, writing Doc:
";Cstr(Doccountb);" of ";Cstr(Doccounta-1)
Call Doc.PutInFolder( OriginalView )
Set Doc= View.GetNextDocument(Doc)
Doccountb = Doccountb + 1

Call View.Remove ' remove temporary folder
End If
End If
End Forall
End If
Set db = dbdir.GetNextDatabase ' navigate to next database file
End Sub

Dig Deeper on Domino Resources - Part 2



  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/ community. These cheat ...

  • HTML cheat sheet

    This is a really cool cheat sheet if you're looking to learn more about HTML. You'll find just about everything you every wanted ...

  • Carol Woodbury: Security

    Carol Woodbury