c# - How to reply to an Outlook mailitem using .net -
i writing outlook 2007 add-in composes business quote in response email query. compose quote using windows forms. works fine until point of replying original message quote information.
private void btnsend_click(object sender, eventargs e) { outlook.mailitem themail = ((outlook._mailitem)quote.mailitem).reply(); themail.subject = "this quote"; themail.body = <some html composed elsewhere>; outlook.recipient rcp = themail.recipients.add("joe blow"); outlook.addressentry ae = rcp.addressentry; ae.address = "joe@blow.com"; }
where quote.mailitem
incoming email request. when run code, throws exception executing rcp.addressentry
. error
'an object cannot found'
. need able add , delete addressees setting cc , bcc fields on quote before send out. addressees may not in address book. have done other mail libraries , should simple, seem barking wrong tree outlook.
edit found - dmitry pointing me in right direction.
outlook.recipient rcp = themail.recipients.add("joe blow <joe@blow.com>"); rcp.type = (int)outlook.olmailrecipienttype.olto;
the recipient must resolved first . , cannot set addressentry.address property - if settable, not point message recipients table.
outlook.recipient rcp = themail.recipients.add("joe blow <joe@blow.com>"); rcp.resolve();
Comments
Post a Comment