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
%REM
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.
%ENDREM

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
Call db.open("","")
' 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:
";Cstr(Doccounta)
Call Doc.PutInFolder( "FolderTemp" )
Set Doc= View.GetNextDocument(Doc)
Doccounta = Doccounta + 1
Wend

' 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
Wend

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

Dig Deeper on Domino Resources - Part 2

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