Latvia Lotus User Group (www.vlaad.lv)

Creating empy NotesDocumentCollection with Set MyCol = db.CreateDocumentCollection() UNDOCUMENTED Method.

Vladislav Tatarincev  28 December 2009 10:22:51
I was programming one admin script, which automates some admin things, and came across a problem, that I need an empty Document collection,
to which I can add needed documents, and later process them. I am not doing LotusScript programming everyday, but still may be will be usefull for some people.

We can Add, Merge DocumentCollections, but there is one thing missing creating a empty document collection.
There are workarounds like. http://www-10.lotus.com/ldd/ddwiki.nsf/dx/11262008093158AMWEBK34.htm
Set coll = db.Search("@False", tomorrow, 1)

I have found another one http://www.openntf.org/Projects/codebin/codebin.nsf/0/3297F7585F816C44862575250016C768
posted by "David J Montalvo" 

Dim MyCol As NotesDocumentCollection
Set MyCol = db.CreateDocumentCollection()


CreateDocumentCollection - Undocumented = Unsupported Method. It will be nice if this will be documented, so can be used in scripts (because now no warranty it will stay in 8.5.2).

There is also Undocumented Method db.Archive() in Notes Database.
Archive() method is rather for a long time in NotesDatabase.

It would be nice to know or have a list of all undocumented methods :)

Comments

1Dmytro Pastovenskyi  28.12.2009 11:03:54  Creating empy NotesDocumentCollection with Set MyCol = db.CreateDocumentCollection() UNDOCUMENTED Method.

Set collection = thisDb.GetProfileDocCollection( "NOSUCHTHING" ).

this one probably more easy to use (of course createdocumentcollection would be better)

2Nathan T. Freeman  28.12.2009 14:32:10  Creating empy NotesDocumentCollection with Set MyCol = db.CreateDocumentCollection() UNDOCUMENTED Method.

There is a subtle difference between the various approaches available. When you use db.CreateDocumentCollection(), the result is an UNSORTED collection. That is, the collection always processes in the NoteID order of the documents added to it. The same for collections returned from .search()

However, if you build a collection from .getAllDocumentsByKey, then even if the result set is empty, it is considered a sorted collection, and will therefore be handled first-in-first-out in the order in which you add the documents.

This difference, while subtle, turns out to have very important implications for certain types of operations.

3Charles Robinson  28.12.2009 21:51:10  Creating empy NotesDocumentCollection with Set MyCol = db.CreateDocumentCollection() UNDOCUMENTED Method.

I remember someone from Lotus talking about this at Lotusphere 2008. Erik Brooks blogged about finding it in the SPR list, too: { Link } .

@Nathan - thanks for that tip, it's definitely good to know. I never considered that the NotesDocumentCollection itself carried some attributes that would affect document sort order.