We help IT Professionals succeed at work.

move lotus notes folder to an other database

PLEONAmando asked
Medium Priority
Last Modified: 2013-12-18

I need to move a folder from an user database to an other database.
When I open the option move database in lotus notes client, I don't have acess to other database open in lotus notes.
If you know the method to do this on lotus notes or a program it capable to do this.
I use lotus notes 6.5.1

best regard
Watch Question

Hi PLEONAmando,
you need to move folder with all documents from one LN database (.NSF) to the other?




Yes, I have to move one folder, with subfolder and documents to one base xxx01.nsf to an other base xxx02.nsf.
Groupware Consultant
You have to create those new databases first, with the right template (StdR6Mail I suppose). Then you can go in a folder and select all mails present, Edit/Cut, go to the new database, Edit/Paste.

A folder in Notes is "nothing". Mail documents are not "in" a folder, but instead a document is labelled with "I'm in folder X". Consequence: you cannot copy a folder, but you can copy its content.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Sjef BosmanGroupware Consultant

Maybe it's easier just to copy the existing mail database to two new databases, and then remove the unwanted documents?

do you want to do it once or you need that as a feature (an action that does that so you can use it many times)?



I a newbie in notes administration, I am an Exchange administrator.
And I am surprised that such a simple operation under exchange (open the two base an drag an drop the folder), that is so complicated under notes.

This folder is "client" and have more than 50 subfolders and the size base is 2,6 Gb, the two solution are not the fastest, but if I don't have an other solution.

For the moment once, but if I have to do the same an other time I'm prefer to have an automate solution.

This code will ask you which folders you want to move and after that it will ask you to which database you want them moved.

First create the copy of your db that contains folders and open that copy in designer and follow the procedure:

Create new agent in the db where the folders are now.
Paste this code in Initialize event of the agent:

Sub Initialize
    Dim s As New NotesSession
    Dim w As New NotesUIWorkspace
    Dim dbSource As NotesDatabase, dbDest As NotesDatabase
    Dim source As NotesView, dest As NotesView
    Dim vc As NotesViewEntryCollection
    Dim docDest As NotesDocument
    Dim ve As NotesViewEntry
    Dim folders() As String
    Dim i As Integer
    Dim ret, rez
    Set dbSource = s.CurrentDatabase
    Forall v In dbSource.Views
        If v.IsFolder Then
            i = i + 1
            Redim Preserve folders( i - 1 ) As String
            folders( i - 1 ) = v.Name
        End If
    End Forall
    ret = w.Prompt( PROMPT_OKCANCELLISTMULT, "Folder selection", "Select one or more folders to move.", folders(0), folders )
    If Isempty( ret ) Then
        Messagebox "User canceled", , "Folder not selected"
        Exit Sub
        Forall f In ret    
            Set source = dbSource.GetView( f )
            Set vc = source.AllEntries
            rez = w.Prompt( 13, "Database selection", "Choose the database to move the folder to" )
            If Isempty( rez ) Then Messagebox "User canceled", , "Database not selected" : Exit Sub
            Set dbDest = s.GetDatabase( rez(0), rez(1), False )
            Call dbDest.EnableFolder( f )
            Set ve = vc.GetFirstEntry
            Do Until ve Is Nothing
                Set docDest = ve.Document.CopyToDatabase( dbDest )
                Call docDest.PutInFolder( f )
                Set ve = vc.GetNextEntry( ve )
            Call vc.RemoveAllFromFolder( f )
            Call source.Remove
        End Forall
    End If
End Sub

Then create the new empty (ctrl+n) db (which you'll select after, when the code asks you for the destination db).
To test the code open the created copy of folders db and choose from toolbar Actions - <name of the agent>

Hope this helps,
I don't believe this action should be that complicated. I have done this in the past many times. Really, all you need is manager access to database B. Create the folder structure in database B. Then go back to the original folder and it's sub folders and just copy and paste the data from the original folder and sub folders to database B in the same folder names. That is one way to do it. You could also replicate the folder into database B using a replication formula. First you would go to replication settings on database A (where the folder resides that you want to copy over to the other database) and go to replication settings. On the Basics tab you would select to "sent documents to server" (presumably you have the other database on a server) and then on the advanced tab select "Docunents in specified views or folders". Then you would go to the folder you want to move over and select it by highlighting it. Close the replication settings dialog box and then go to replication. Select "replicate with options" and then choose "send only", then replicate with database B. That should create the folder and it's sub folders in database B. You could choose to do it the other way and recieve selected views and folders from database A to pull into database B. Or, you can try the code above. Good luck!
Sjef BosmanGroupware Consultant

> I don't believe this action should be that complicated.
Your method seems pretty complicated if you ask me...

And, A and B would be replica databases. If that's not intended, then you may need to copy a database after all (in Notes, to get a new replica-ID).

You are entitled to your opinion. And I know that you get a new replica ID with a new copy (there are tools out ther to modify the replica ID). Not sure why you mention that as all I am saying is that he could replicate the folder he wants and it's sub folders only into the other database. But, thanks for you comments anyway.
Sjef BosmanGroupware Consultant

No offence meant.

Some feedback from PLEONAmando would be nice, though...

none taken, for any given problem there is usually more than one approach that will work. I was really referring to another suggested solution. And yes, I agree some more feedback from the original poster of the question would be good.....Also, I think I might have misunderstood the question/not enough info to really get a grasp on it....as well.

if you're talking about my solution, it's far less complicated then yours (maybe it seems complicated to you cuz of copying the db, but that's only the precausion).
It comes down to creating an agent and pasting the code.

If he uses selective replication, as you suggested, then it will have to be replica (as Sjef mentioned).
You talk about complications and then you mention changing the replica ID :)

By the way, you don't need tools for that:
Declare Function NSFDbReplicaInfoSet Lib "NNOTES" Alias "NSFDbReplicaInfoSet" ( Byval H As Long, R As ReplicaInfo) As Integer


Marko, as a newbie administrator (which PLEONAamando said he is) I had the thought that perhaps writing an agent (or copying your code) and getting it to work might be a bit much for him to attempt. As I also stated, I don't think I had a good grasp on what he was trying to do. For example: is the second dB a replica of the first one (w/same rep id) or is it a copy? The information provided in his post is not very detailed. So, that is why I offered a solution that might seem simpler to him. My solution(s) are quite simple if you know your way around Notes. As for changing replica ids, I prefer a simple tool rather than writing code to accomplish that. But, each to his/her own.......
As far as I'm concerned, I'm done with this question now. So, no need to chastise me any further, ok?


sorry for my absence of response.
I had an accident with my tendon of Achilles by making sport.
I would be back to work the next week, and I could test yours solutions at this time.


Sorry to hear that, PLEONAmando. Well, you have a variety of solutions to try. Good Luck.
Sjef BosmanGroupware Consultant

That's bad. What's the sport? Squash is "famous"...

Hey Rickhal, don't give up too soon. I think your (or anybody else's) point of view is very valuable and I read all contributions. Sometimes I'm wrong, jumping to conclusions when I didn't read the question or the posts carefully enough. Sometimes I think I read the question better, so I try to defend my point. Quite often though, the question is hard to "read", whatever the reason is. In time, one developes a 6th sense for question reading, between the lines, under the ink, wherever. There's no need to defend yourself as no attacks were made.

I think we both tripped over your sentence "I don't believe this action should be that complicated", in which we assumed that "this" referred to one of our remarks. And indeed the question is foggy...
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.