We recently enabled FolderReferences on a database that already contained a lot of documents. According to everything I've read, you can only get FolderReferences for documents added to a folder after the property is enabled, but we needed to get it set for all the existing documents as well. I found a pretty simple way to do it. Just add an action to your folder template and refresh the design of all folders (or add the action to each folder) and run on selected documents.
Here's the code:
Sub Click(Source As Button) On Error Goto errhand Dim w as new notesuiworkspace Dim s As New notessession Dim db As notesdatabase Dim v As notesview Dim uiv as notesuiview Dim doc As notesdocument Dim dc As notesdocumentcollection
Set db = s.currentdatabase Set dc = db.unprocesseddocuments Set uiv = uiw.currentview Set v = uiv.view
Set doc = dc.getfirstdocument While Not doc Is Nothing Call doc.RemoveFromFolder(v.Name) Call doc.PutInFolder(v.Name, False) nextDoc: Set doc = dc.getnextdocument(doc) Wend
Call uiv.deselectall Call w.ViewRefresh
Exit Sub errhand: Print "Error at line " & Erl & ": " & Error & " for UNID " & doc.universalid Resume nextDoc End Sub
This LotusScript was converted to HTML using the ls2html routine, provided by Julian Robichaux at nsftools.com.