I need to set a MAPI property on a newly created MapiRecipient.
I believe to do that I must do something like this:
MapiMessage mapiMessage = new(OutlookMessageFormat.Unicode);
mapiMessage.Recipients.Add("blah@blah.blah", "SMTP", "Blah Blah", MapiRecipientType.MAPI_TO);
MapiRecipient newRecipient = mapiMessage.Recipients.Last();
// act on newRecipient
But I have to assume that the new recipient is appended to the end of the collection.
Since MapiRecipient can only be instantiated by the .Add(...) methods, it would be helpful if either:
- the documentation explicitly stated that
.Add(...)always appends to the end of the collection, or MapiRecipientCollection.Add(...)returned the newly created instance, similar to howSystem.Data.DataRowCollection.Add(...)does.
System.Data.DataTable dt = new System.Data.DataTable();
var newRow = dt.Rows.Add();
Same for MapiAttachmentCollection.