SDKCollection Objects contain methods to Add, AddByRef, RemoveByRef, and New. The Add method allows you to create a new Object within the collection. In this case, the Add method only cares about the model data so it would require a model interface.
Using the AddByRef and RemoveByRef allows you to link and unlink by object ID. Each type will have an associated ID property that can be used to link into a given type collection. For example, you could add a folder to the Subfolders collection of another folder to build hierarchy.
The New method returns an empty Model for convenience. Once you “Add” the Model to a collection, the Add method will return an SDK version ready for navigation. The ID field and other relevant links are populated.
Messages are constructed using the Message and Attachment Models. These Models implement interfaces found in the Quest.AM.Public.Interfaces and require some types from Quest.AM.Public. Messages and attachments have many properties. Most are metadata that is not required. The following is an example of populating the general Message fields.
IMessage message = new Message();
Body elements are provided as a Stream type using the StreamAsIDataStream2 wrapper class. The Constructor contains a few fields that are for internal use only at the moment. The important fields will be the stream with the content, the DataStreamPartType, and the stream length.
Attachments are added to the message’s Attachments collection. An Attachment contains many meta-properties used to describe the attachment, but not all are required.
The attachment stream is also uses the StreamAsIDataStream2 wrapper class. The property StreamType needs to be set based on the type of attachment it is. In this case, ByValue for an actual attachment file.
Attaching messages as embedded messages can be done by assigning the message object to the Data property of the attachment. Setting the StreamType to 6 for EmbeddedMsg will allow the parser to properly handle the embedded message.