MapiRecipientCollection.Add(...) -- return newly created instance

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 how System.Data.DataRowCollection.Add(...) does.
                System.Data.DataTable dt = new System.Data.DataTable();
                var newRow = dt.Rows.Add();

Same for MapiAttachmentCollection.

Hello @weswt,

We’ll share your suggestion with our development team for evaluation and consideration in future improvements. Thank you for taking the time to provide this feedback.

@weswt
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): EMAILNET-41805

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.