PutInFolder method – does not allocate my private folder

For a search function in an application I would like to place results in a private (desktop) folder. For that I created a shared, private on first use folder. I do not want to have a folder residing on the server side because I fear this will blow up the view indexes. It is also a restriction in our environment (create personal folders is by default disabled).

The private folder will be created when opening the search form which is embedded in a split frame (on top the search form, in the bottom the folder).

However when I use the PutInFolder method, this tries to place result documents in the first folder it finds, in this case the shared, private on first use folder.

Call srchDoc.PutInFolder(“$fld-searchresults”)

This is also confirmed via a warning message:

If I look in design it seems the method wants to place the documents in the first folder it finds:

AddToFolder

On the other hand, when I have a document opened the AddToFolder formula has no problem with finding the correct folder:

@AddToFolder(“$fld-searchresults”;””)

Question

My question is quiet simple:

How can I make sure that my code places the documents in the private folder and not the shared one?

Advertisements

5 thoughts on “PutInFolder method – does not allocate my private folder

  1. Patrick Kwinten 2010-November-17 / 12:16 pm

    I tried to build in a filter via the IsPrivate property:

    Dim session As New NotesSession
    Dim db As NotesDatabase
    Dim views As Variant
    Set db = session.CurrentDatabase
    views = db.Views
    Forall v In views
    If v.Aliases(0) = “$fld-searchresults” Then
    If v.IsPrivate Then
    Msgbox “found”
    End If
    End If
    End Forall

    but then I get an error for the shared on first use folder:

    Notes error: Index is not to be generated on server 😕

  2. Urs Meli 2010-November-17 / 1:55 pm

    Hi
    Folders don’t have view indexes as far as I know. So there should be no performance impact with that.

    Where does your script code run?

    kind regards

  3. Peter Presnell 2010-November-17 / 1:57 pm

    Hi Patrick. The documentation for NotesDocument.PutInFolder states that Shared, Private On First Use folders cannot be used for this method, so I doubt you’ll ever get it to work. I would suggest trying the NotesDocumentCollection.PutAllInFolder method instead. For the filter I would suggest testing for IsPrivate first before trying to access the aliases.

  4. Vitor Pereira 2010-November-17 / 7:21 pm

    Both PutAllInFolder and PutInFolder methods have a parameter to create the folder if it does not exist but I’m not sure it works with shared, private on first use folders

    Call notesDocumentCollection.PutAllInFolder( folderName$ [, createonfail ] )

    If it doesn’t work with shared, private on first use folders you can always try to put in a regular folder named after the current user and if it doesn’t exist it will create it for him. I’m guessing you have to create a base folder with the design you want and set it as ‘default design for new folders and views’.

  5. Kathy Brown 2010-November-29 / 11:00 pm

    Can you use the NotesUIWorkspace.Folder method? Documentation doesn’t say it won’t work on private folders. Didn’t try it myself, but who knows.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s