C API - Problem creating RichText field from CompoundText

I’m using the C API to create a new RichText field in a note. I created a buffer of CDRecords that starts with a PABDEFINITION, when I tried to do an NSFItemAppend the command seems to work but when I do the NSFNoteUpdateExtended to save the changes, I get the error about an “Invalid Structure”.

Trying a different approach, using the buffer of CD Records, I created a CompoundText, and using NSFItemAppendByBLOCKID created a field, the update was successful, but the Notes properties tells me its an “Index Collation” -whatever that is.

I dumped the CD records to a file and was able to read the file correctly using the NSF_DUMP sample program. The length factors on everything seem to add up ok.

My problem is how do you identify a Rich Text field. Do I need something in the CDRecords to Identify RichText to go the NSFItemAppendByBLOCKID route? if so what CD Type record should I build? (I was looking a BSIG/WSIG/LSIG, but got no where)

If I go the NSFItemAppend route, I get nowhere in debugging the problem.

Any help would be appreciated.

Subject: C API - Problem creating RichText field from CompoundText

There are lots of reasons why you could get the Invalid Structure message. The most common I have run into have been having incorrect lengths in the Header of each structure, not aligning the structures on even byte boundaries, or having an incorrect length for the whole item.

Subject: C API - Problem creating RichText field from CompoundText

Identify the item as Rich Text (TYPE_COMPOSITE) when you call NSFItemAppend. For example, in the LotusScript sample here, that is the purpose of the value 1 in the call. I use the NotesPeek tool from the Sandbox to check the structure at the record level. At the byte level, I create some Rich Text data manually, then try to create the same data using my code. After dumping both versions, it is easy to find where they differ.

Subject: *Good advice. Start simple and try to match an existing rich text field, then move on.