Re: Setting Content-ID without CDO or Redemption



You're a lifesaver!

I was missing the save command on the message, so I guess the changes I was
making were being lost.

I ported the code over to Visual Studio for some further experimentation;
I'll tidy it up a little and then post it here a bit later in case others
come across the same situation.

Thanks heaps Dmitry!

Ben


"Dmitry Streblechenko" <dmitry@xxxxxxxxxxx> wrote in message
news:ujiuWSdTIHA.5016@xxxxxxxxxxxxxxxxxxxxxxx
Don't forget to call Att->SaveChanges(KEEP_OPEN_READWRITE), followed by
IMessage::SaveChanges at a later time.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"BenM" <nospam.flexibull@xxxxxxxxxxxxxxxx> wrote in message
news:%23iCfVLcTIHA.1208@xxxxxxxxxxxxxxxxxxxxxxx
I have what seems to be an ongoing project at the moment, a large part of
which involves getting images into an HTML email in outlook.

So far I have managed to model a solution based on some intriguing
examples at http://www.outlookcode.com/codedetail.aspx?id=27 and
http://www.outlookcode.com/threads.aspx?forumid=2&messageid=25223.

However, there's a catch, as there always is.

Because we don't have fine control over whether our customers have
installed CDO with outlook, and because of concerns about installing (let
alone purchasing) yet another library our software management are not yet
prepared to use Redemption. We're also using Borland Builder, developing
in C++, and integrating to Outlook from another application, so the
examples above (in VB and JScript) don't apply directly. Instead of using
CDO therefore I'm using extended MAPI.

My problem at present seems to be that even though I'm setting properties
to Extended MAPI's IAttach object with the same values as the Fields in
the above examples, they don't seem to result in the correct behaviour,
and my images are not embedded as required.

ie, the code in question looks something like this:

Msg->OpenAttach(attachnum, NULL, MAPI_MODIFY, &Att);
try {
//With the attachment open, attempt to add non-default fields.
pProps[0].ulPropTag = PR_ATTACH_MIME_TAG;
pProps[0].Value.lpszA = "image/jpeg";
pProps[1].ulPropTag = PR_ATTACH_CONTENT_ID;
pProps[1].Value.lpszA = "example";
Att->SetProps(2, pProps, NULL);
} __finally {
Att->Release(); //Always release, even if we throw an exception.
}

I realise this is a little different to a basic VBA question, but does
anyone have any feedback/experience using MAPI to do the job of CDO in
this sort of case? Documentation thus far appears to be fairly scarce (or
I'm looking in the wrong places). Do you think it's even possible? Given
CDO is (apparently?) built on top of MAPI I'd have thought so, but now
I'm not so sure.

I would be happy to post a (verbose, but complete) stand-alone code
example if anyone is particularly interested, however given the compiler
and language differences I suspect it may not be so helpful. As an aside,
most of my experience has been with Visual Studio and I find the change
to Borland to be... interesting.

Cheers in advance.

Ben





.



Relevant Pages

  • Re: Outlook 2033 - detect if Exchange is available
    ... ' .NET Assemblies showing as MAPI: ... ' .NET Assemblies showing as CDO: Microsoft CDO for Windows 2000 Library ... OutlookSpy - Outlook, CDO ... even offline) to an Exchange Server ...
    (microsoft.public.outlook.program_vba)
  • Re: setting MAPI fields in OLK 2003 with .NET 2003
    ... Dim sItem As New Redemption.SafeMailItem, ... 'to convince Outlook something has changed ... OutlookSpy - Outlook, CDO ... yes I'm using CDO to set mapi fields. ...
    (microsoft.public.office.developer.outlook.vba)
  • Re: Exchange/Outlook 2007 MAPI in WinXP
    ... It looks like CDO did the trick. ... Do you really need Outlook? ... But, as you said, the other (MAPI) package will not install if Outlook is ...
    (microsoft.public.win32.programmer.messaging)
  • Re: Report To HTML and email
    ... CDO 1.x is a subset of MAPI. ... MAPI althogether (And security messages issued by Outlook) ...
    (microsoft.public.fox.vfp.reports.printing)
  • Re: How to replace an attachment from a file.wav to a winmail.dat
    ... And it will not have Outlook installed on. ... when the code tries to convert back from MAPI to MIME using the ... we created one stream object with the contents of the file using the ... and we created the new tnef stream using the OpenTnefStreamEx ...
    (microsoft.public.win32.programmer.messaging)

Loading