About This Code
Brief Description:
Creating an Empty Document Collection - Undocumented Code
Contributor:
David J Montalvo
Last Modified:
19 Dec 2008
OpenNTF Disclaimer
All of the program code and information presented in the OpenNTF.org Code Bin are provided "as-is", and should be used at your own risk. OpenNTF.org make no express or implied warranty about anything in the Code Bin, and OpenNTF.org will not be responsible or liable for any damage caused by the use or misuse of anything from this site. OpenNTF.org makes no guarantees about anything. Please thoroughly test all of the knowledge and code you find here before you attempt to use them in your production environment.
Code / Description
Have you ever wanted to build your own custom document collections? I have, imagine my surprise when I came across this undocumented code within the R8 Mail Template which lets you do just that:
CreateDocumentCollection()
This handy little timesaver allows you to quickly initialize an empty collection. Here is an example:
Dim MyCol As NotesDocumentCollection
Set MyCol = db.CreateDocumentCollection()
You are now free to add documents to your empty collection.
Note: Before this method the only way I knew of to achieve this was to "getalldocumentsbykey" using a key that does not exist.
Usage / Example
Comments
Posted by Marko Bonaci on 12/24/2008 05:17:34 AMMore about this
http://ideajam.net/IdeaJam/P/ij.nsf/0/3FAD44895EB1665E8625738400731694?OpenDocument
Posted by Darius Burger on 09/29/2009 09:15:01 AMAwesomeness
Hi David -
Very cool! Will be handy as hell! :-)
Regards,
Darius
Posted by Tim Paque on 12/09/2009 06:53:52 PMAre you Kidding Me!
I've had to do crazy stuff to get around this like:
Dim DC as NotesDocumentCollection
Set DC = DB.GetProfileDocCollection("Chickens")
Now, this was fast and reliable, but kinda weird ;-)
Posted by Trond Nielsen on 01/24/2010 03:14:24 PMGlad someone found this one.
I sure spent hours coding around this one. Very welcome info.