Hi, I'm using the Domino.doc 3.5 API to load the Domino.doc layout into a VB app. The problem is that because we use a "" in the BinderCategory to subcategorize binders, I cannot pick it up using the API. The code works perfectly for binders without subcategories.
If you can help it would be much appreciated and I will be even more impressed!
Here's the code:
For iBinders = 0 To
(theRooms.ItemByTitle
(cmbRooms.Text).Cabinets.ItemByTitle
(cmbFileCabinets.Text).Categories
.ItemByTitle
(cmbBinderCategory.Text).Binders.Count - 1)
cmbBinders.AddItem theRooms.ItemByTitle
(cmbRooms.Text).Cabinets.ItemByTitle
(cmbFileCabinets.Text).Categories
.ItemByTitle
(cmbBinderCategory.Text).Binders.ItemByIndex(iBinders).Title, iBinders
Next iBinders
I don't have any experience with the Domino.doc API, so I consulted with our colleague, John
Marshall of SwapCode fame. Here's John's reply:
I finally realized what the code was doing after giving myself a brief headache. I presume the SearchDomino.com member is adding the category to a Tree view node or list box. I am not surprised they are having trouble with categories. The Categories, Category objects are among the most poorly documented and confusing objects in the Domino.doc API. Some of the documentation is just plain wrong and in the older versions of the Domino.doc enabler the software did not work at all or as expected.
I have dug out an example of retrieving subcategories using VBScript, which can be easily converted to VB. The page points to an example (ddcReporter) I was developing on how to access the Domino.Doc using the API via a browser. The VBScript is a little crude but fairly clear to read if you take out all the HTML creation lines.
Note from Brian: The VBScript John is referring to in this last paragraph can be seen by viewing the source code of the displayed page. Choose View Source from your browser menu and look for the code within the tag "script type="text/vbscript")
There are two methods depending on were you get the Categories object, which can be at Cabinet level and Binder Level.
The Binder level method is the simplest and involves testing for the HasParentCategory property and retrieving it and then its parent then the parent of the parent, etc. Working upwards to construct the subcategories.
The Cabinet level method is more complex and involves iterating through Categories in a Category then iterating through the Categories of each Category of the previous Category etc. Working downwards to construct the subcategories.
OK, it's about as clear as mud. So the easiest way is just to look at the VBScript example page and see what you can use.
-- John Marshall
This was first published in August 2003