Tuesday, July 22, 2008

How to initialize NotesDocumentCollection in zero

Sometimes I have tasks where I should start to work with empty collection of documents. One of my fellow shown me yesterday probably the simplest solutions how we can got empty collection.

Set notesDocumentCollection = notesDatabase.GetProfileDocCollection("WRONG_NAME")


I like this solution and as I see it is perhaps the best one.

p.s. if anybody has better solution I would be happy to see it.

5 comments :

Anonymous said...

You are doing it the best way...

http://www.bananahome.com/users/bananahome/blog.nsf/d6plinks/PSTL-6UWC7K

Spanky said...

That is how I do it as well. However, because you can never truly be certain that WRONG_NAME hasn't been used to create a profile document in the past, it is always a good idea to test for the existence of docs in the collection (profileDocCollection.Count > 0). If the collection has entries, it is a simple matter to remove them.

-Devin.

Anonymous said...

isnt it from now on something with db.notesdocumentcollection?

Dmytro said...

sorry, what do you mean?

Unknown said...

There is a new method in Notes 8.

NotesDatabase.CreateDocumentCollection

I think this is what quintessens was referring to.