Some folders lost

I have some users who have many folders in their mailfiles (one has 48 folders with some of them one or two subfolders). Some of the folders and subfolders are missing. I can’t see the missing folders when the mailfile is opened in Designer. Recently the mailfile is upgraded from version 7.01 to version 8.5.1, because of server / client upgrade.

How would I get back the missing (“unvisible?”) folders?

I already tried load updall mail\filename.nsf -C

Koos van Harmelen

Subject: Prevent folder loss by installing Folder Restore Tool

Install the Folder Restore Tool and you never have this problem again. Just one click and the entire folder structure is restored.

For ten applications, this solution is free:

http://www.lialis.com/lotussolutionprovider.nsf/pages/folderrestoretoollotusnotesmail

Subject: they are gone

most likely the folders were not protected and when the design was upgraded the folders were deleted. Not to worry, the documents in the folders should still be in the mail file and accessible via the All Documents view. If you have a back of the mail file from before the upgrade then you can get them back but it’s a bit tricky to get the documents back in the folders. You can try these steps.

  1. Restore the backup copy to a different location

  2. in the restored mail file create a simple agent with “Copy to database” as the action and choose the user’s production mail file as the destination database. The agent should act on Selected Documents

  3. Open the hidden ($FolderInfo) view in the restored mail file and locate the missing folders in the list. Place a check mark next to the document representing each folder then run the agent you just created.

  4. Now open the production mail file and if you are lucky the folders and the documents will be back.

NOTE: You cannot simply do a copy/paste of the folder reference docs, you must use the copy to database action in order to preserve the document ID.

I’ve done this many time and in most cases the documents will reappear in their respective folders but in some cases they do not. If they do not you can copy/paste then from the restored mail file folders to the production mail file folders but this will likely create duplicate copies of the same documents because as I mentioned above, even though the folders are missing the documents that were in the folders are still there. Now there is a way you can programatically do this without creating duplicates. This requires another agent using the below code. Make sure you review and understand it before using it at your own risk.

  • Running this agent will lock up your client until the agent completes. A folder with 3000 documents in it will take about 15 minutes to complete.

  • Be sure to modify mailfile$ to reflect the name of the production file you are restoring to

  • As coded, this agent will restore previously deleted documents. If the documents still exist in the Trash folder then the agent will bomb so make sure the Trash in the production mail file has been emptied. If you do not want to restore deleted docs and ONLY want to move docs that are missing from the folder but still exist in the production database then REM out the 3 lines below the ELSE statement, as outlined below.

Sub Initialize

On Error Goto errout

Dim ws As New NotesUIWorkspace

Dim ns As New NotesSession

Dim sdb As NotesDatabase ' source db

Dim ddb As NotesDatabase ' destination db

Dim sdoc As NotesDocument ' source db document

Dim ddoc As NotesDocument ' destination db document

Dim ndc As NotesDocumentCollection

Set sdb = ns.CurrentDatabase

mailfile$ = "mail\kastra.nsf" ' the filepath of the user's production mail file

Set ddb = ns.GetDatabase( sdb.Server, mailfile$) ' assumes source db and destination db are on the same server

Set ndc = sdb.UnprocessedDocuments ' all selected documents

Set sdoc = ndc.GetFirstDocument

foldercount% = ndc.Count ' total docs in folder

tmpcount% = 0

totalcount% = 0

moved% = 0 ' total docs moved to folder

copied% = 0 ' total docs copied from sdb to ddb

vw$ = ws.CurrentView.ViewName ' the name of the current folder

While Not sdoc Is Nothing

	On Error 4091 Resume Next ' need this to handle Invalid Universal ID error

	Set ddoc = ddb.GetDocumentByUNID(sdoc.UniversalID)

	tmpcount% = tmpcount% + 1

	If Not ddoc Is Nothing Then

		Call ddoc.PutInFolder(vw$, True) ' if the doc already exists in ddb it's added to the folder

		moved% = moved% + 1

	Else

		' If you do not want to restore and deleted documents then REM out the next 3 lines

		Call sdoc.CopyToDatabase(ddb) ' if the doc is not found in ddb it's copied 

		Call sdoc.PutInFolder(vw$, True) ' and added to the folder

		copied% = copied% + 1

	End If

	Set sdoc = ndc.GetNextDocument(sdoc)

	If tmpcount% = 100 Then

		totalcount% = totalcount% + tmpcount%

		tmpcount% = 0

		Print "processing " & Cstr(totalcount%) & " of " & Cstr(foldercount%)

	End If

Wend

xit:

Print "moved " & Cstr(moved%) & ", copied " & Cstr(copied%) & " of " & Cstr(foldercount%)

Exit Sub

errout:

Print Error & " - " & Err & " at line # " Erl

Resume xit

End Sub

Subject: Cause?

Thank you very much for the reply. Indeed, one of the users is missing a lot of folders, so in that case your code will be helpfull.BUT: I would like to know why this happened. I checked some settings: all folders are public (no private). The original mailfiles reside on a retired server. There I could check the design refresh setting: every folder in every mailfile has cheched the Prohibit Design refresh or replace to modify, so even for the disappeared folders.

Subject: corrupt

maybe the folders were corrupt and the server deleted them? No telling for sure.