I found that the recipients can be accessed and modified by Extended MAPI in
the message at MailItem.MAPIOBJECT, but only when the
MailItem.BeforeCheckNames event is called when the user clicks Send. So I'm
able to add a recipient using the object model while the message is being
composed (the user can see the new recipient), and then when the user clicks
Send I can use Extended MAPI to modify recipients going to my gateway,
replacing the recipient with a new one-off making sure that "send rich info"
is enabled. Not ideal, but it seems to work. I hope that Microsoft doesn't
remove the ability to modify recipients with Extended MAPI off of the
BeforeCheckNames event, or I would have a real problem!
"Dmitry Streblechenko" wrote:
> When exactly do you add the recipients? When yo uare using Extended MAPi
> (be that from ECE or from MailItem.MAPIOBJECT), OOM has hard time seeing the
> changes, but there are some workarounds.
>
> --
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
> -
> "Nick" <(E-Mail Removed)> wrote in message
> news:9EDADBD5-899D-49DB-9665-(E-Mail Removed)...
> > For years we've used the "Exchange Extensions" function SetRecipients()
> > that
> > lets you use Extended MAPI to create an address list and then add that
> > list
> > to a message that the user is composing. Of course with Outlook 2010
> > Exchange Extensions are gone. This functionality is required because we
> > need
> > to create one-off addresses that force winmail.dat to be sent to the
> > recipient. I know that most people want to get rid of winmail.dat, but we
> > need it because our users can send messages to our SMTP gateway that
> > parses
> > winmail.dat. This SMTP gateway is "legacy" code that I can't change.
> >
> > Using the newer Outlook object model and adding recipients to a MailItem
> > would be nice, if only it would allow me to enable the "send rich info"
> > behavior. But it appears that Microsoft has eliminated this functionality
> > by
> > not providing a means for a programmer to create a one-off in a message
> > that
> > is being composed that would force winmail.dat to be sent to the recipient
> > (you can do this manually in Outlook by changing the "Internet format" for
> > an
> > address to "Send using Outlook Rich Text format").
> >
> > I'm familiar with Extended MAPI, so I've tried using ModifyRecipients() to
> > add a one-off to a IMessage obtained from a MailItem.MAPIOBJECT, but there
> > appears to be a disconnect between the Extended MAPI world and the
> > MailItem,
> > and the recipients in the MailItem are not changed (don't appear). Also,
> > I've tried using the object model technique, adding a recipient like so
> > "Name[EX:(E-Mail Removed)]" that causes Outlook to enable the "send
> > rich
> > info" the way I want, but that's not the address I want to send to, I want
> > it
> > to go via SMTP to "(E-Mail Removed)" and not an EX: address.
> >
> > I know how to write add-ins and create ribbons for user-interface changes,
> > but I'm at a loss for how to add a one-off recipient to a message that a
> > user
> > is composing, that forces the properties to send winmail.dat to that
> > recipient (i.e., Internet format = Send using Outlook Rich Text format),
> > and
> > have that new address appear in the list of recipients that the user sees.
> >
> > Any suggestions? Thanks in advance...
>
>
> .
>