Get 'Personal Folders On First Use' With LotusScript

Posted by Tobias Mueller

Today I had an interesting problem. If you want to check personal folders with LotusScript you can't get them (except your script runs local).

I did a little research in a forum on http://www.lotus.com/ldd and 'bingo'.

The idea behind is to get the UniqueID of the folder and then reference to it.

Function first.


Function isPrivateCopy(pnv As Variant) As Integer
'based on code by Bruno Beauparlant and Heinrich Mueller
Dim designElem As notesDocument
Dim flags As Variant

isPrivateCopy = False

Set designElem = pnv.Parent.GetDocumentByUnid( pnv.UniversalID )
If Not (designElem Is Nothing) Then
If DesignElem.HasItem("$Flags") Then
flags = DesignElem.GetItemValue("$Flags")
Forall f In flags
If Instr(f, "V") > 0 Then
IsPrivateCopy = True
End If
End Forall
End If
End If
End Function

Here an example code

Sub Initialize
Dim s As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim nvec As notesviewentrycollection


Set db = s.CurrentDatabase

Forall v In db.Views
Set view = v
If isPrivateCopy(view) Then
If view.Aliases(0) = "Serial" Then
Set nvec = view.AllEntries
Messagebox Cstr(nvec.Count) & " documents in folder"
End If
End If
End Forall

End Sub

You can find the whole thread here:
Entries in "private on first use" folder

Post a comment