Can you access private views via LotusScript?

Hi,

I am trying to process all of the documents in a ‘private on first access’ view with LotusScript as follows (this code is attached to a button in the view):

Dim wks As New NotesUIWorkspace

Dim viewui As NotesUIView

Dim view As NotesView

Dim doc As NotesDocument

Set viewui = wks.CurrentView

Set view = viewui.view

Set doc = view.GetFirstDocument

I keep getting ‘Object Variable Not Set’ on the last line & it seems to be a problem with LS getting a handle on a ‘private on first access’ view (of which there will be many). I can process docs in shared views without errors.

Is there some sort of trick to this? Is this possible?

Paul.

EDIT: The ‘private on first access’ views are currently stored in the database (on a server), rather than locally.

Subject: Can you access private views via LotusScript?

Here’s another post with code you can modifyhttp://www-10.lotus.com/ldd/nd6forum.nsf/55c38d716d632d9b8525689b005ba1c0/6f662dee97b9ded9852570f30014bfbc?OpenDocument

Subject: Can you access private views via LotusScript?

Hello,

U cannot set the view . But thorugh an agent u can set the private On first Use type of views . I wrote a script sometime back. I’ve a sample script to get handle for the private view .

This one i wrote for removing the private on first use kind of views when the user closed the database.

Might be u can get something out of it.

Here it is :

Dim session As New NotesSession

Dim ws As New NotesUIWorkspace

Dim db As NotesDatabase

Dim view As NotesView

Dim varAnswer As Variant

Dim readers As Variant

Set db = session.CurrentDatabase 

if session.NotesBuildVersion < 190 Then

Set view = db.GetView(“My Booking Requests”)

readers = view.Readers

If Isarray(readers) Then

If Ubound(readers) < 1 Then

If readers(Lbound(readers)) = session.UserName Then

view.Remove

End If

End If

End If

End If

Forall v In db.Views

If v.Name = “My ViewName” And Isarray(v.readers) Then

If v.readers(0)=session.UserName Then

Set view=v

view.Remove

Exit Forall

End If

End If

End Forall

HTH

Tom

Subject: RE: Can you access private views via LotusScript?

Thankyou both for your help.

I’ve just found out there is nothing wrong with my code. The users who were getting the ‘Object Variable Not Set’ error message did not have the ‘Create personal folders/views’ privilege in the ACL (blush!).

Sorry to waste your time…

Paul.