PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook Program Addins Persistent MAPI Properties

Reply

Persistent MAPI Properties

 
Thread Tools Rate Thread
Old 10-12-2003, 09:11 PM   #1
Andrew Roesch
Guest
 
Posts: n/a
Default Persistent MAPI Properties


Hello,

What I am attempting to do is to set a value in a mail message on the
senders side that will be accessible on the recipients side. I was
under the impression that Mapi properties, using the UserProperties
collection was the way to go.

I was using the UserProperties collection but the property was always
gone on the reciepients side. In reading the MAPI API it seems like
this should be possible to create transmitable properties.

What am I doing wrong?
  Reply With Quote
Old 10-12-2003, 10:14 PM   #2
Sue Mosher [MVP]
Guest
 
Posts: n/a
Default Re: Persistent MAPI Properties

This should work, but only if you are sending the message in rich-text format.
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"Andrew Roesch" <junk@digitaldetonator.com> wrote in message news:1dfe51fb.0312101311.1ce7dfb@posting.google.com...
> Hello,
>
> What I am attempting to do is to set a value in a mail message on the
> senders side that will be accessible on the recipients side. I was
> under the impression that Mapi properties, using the UserProperties
> collection was the way to go.
>
> I was using the UserProperties collection but the property was always
> gone on the reciepients side. In reading the MAPI API it seems like
> this should be possible to create transmitable properties.
>
> What am I doing wrong?

  Reply With Quote
Old 10-12-2003, 10:52 PM   #3
Andrew
Guest
 
Posts: n/a
Default Re: Persistent MAPI Properties

"Sue Mosher [MVP]" <suemvp@slipstick.com> wrote in
news:#DLLcp2vDHA.2452@tk2msftngp13.phx.gbl:

> This should work, but only if you are sending the message in rich-text
> format.


Then how do I send a message in rich-text format programmatically?
What are the consequences of sending all mails in rich-text format?
Here is the code I use to send messages written in c# and using
redemption.

SafeMailItem safeMailItem = new SafeMailItem();
// Begin the Forward Process
// Creates a Forward Message
MailItem forward = mailItem.Forward();
// Sets forward message as the SafeMAilItem

safeMailItem.Item = forward;
safeMailItem.Recipients.Add("Test Email");

safeMailItem.Send();
  Reply With Quote
Old 10-12-2003, 11:20 PM   #4
Dmitry Streblechenko
Guest
 
Posts: n/a
Default Re: Persistent MAPI Properties

If you send in the RTF format, only Outlook users will be able to read the
data correctly - you will get the infamous winmail.dat attachment.
The only workaround is to add custom headers to the message header using
Extended MAPI, CDO 1.21 or Redemption:
http://www.dimastr.com/redemption/faq.htm#14
The sample sets the Sender header, but it can be used to add any other
header.
On the receiving side you can access PR_TRANSPORT_MESSAGE_HEADERS property
and see if your header is there.

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


"Andrew Roesch" <junk@digitaldetonator.com> wrote in message
news:1dfe51fb.0312101311.1ce7dfb@posting.google.com...
> Hello,
>
> What I am attempting to do is to set a value in a mail message on the
> senders side that will be accessible on the recipients side. I was
> under the impression that Mapi properties, using the UserProperties
> collection was the way to go.
>
> I was using the UserProperties collection but the property was always
> gone on the reciepients side. In reading the MAPI API it seems like
> this should be possible to create transmitable properties.
>
> What am I doing wrong?



  Reply With Quote
Old 10-12-2003, 11:49 PM   #5
Sue Mosher [MVP]
Guest
 
Posts: n/a
Default Re: Persistent MAPI Properties

Assuming you are using Outlook 2002 or later, you can set the BodyFormat property when you create a new message. I have not tried doing this with a forward, though. Let us know if it works.

--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"Andrew" <junk@digitaldetonator.com> wrote in message news:Xns944DA1769A757junkdigitaldetonator@207.46.248.16...
> "Sue Mosher [MVP]" <suemvp@slipstick.com> wrote in
> news:#DLLcp2vDHA.2452@tk2msftngp13.phx.gbl:
>
> > This should work, but only if you are sending the message in rich-text
> > format.

>
> Then how do I send a message in rich-text format programmatically?
> What are the consequences of sending all mails in rich-text format?
> Here is the code I use to send messages written in c# and using
> redemption.
>
> SafeMailItem safeMailItem = new SafeMailItem();
> // Begin the Forward Process
> // Creates a Forward Message
> MailItem forward = mailItem.Forward();
> // Sets forward message as the SafeMAilItem
>
> safeMailItem.Item = forward;
> safeMailItem.Recipients.Add("Test Email");
>
> safeMailItem.Send();

  Reply With Quote
Old 11-12-2003, 12:06 AM   #6
Andrew
Guest
 
Posts: n/a
Default Re: Persistent MAPI Properties

"Sue Mosher [MVP]" <suemvp@slipstick.com> wrote in
news:eykgpj3vDHA.2460@TK2MSFTNGP10.phx.gbl:

> Assuming you are using Outlook 2002 or later, you can set the
> BodyFormat property when you create a new message. I have not tried
> doing this with a forward, though. Let us know if it works.
>


Setting the BodyFormat does not work. I am currently trying Dmitry's
suggestion.
  Reply With Quote
Old 11-12-2003, 12:39 AM   #7
Andrew
Guest
 
Posts: n/a
Default Re: Persistent MAPI Properties

When you do this, do you have to use a pre-exisitng header? The example
you gave works fine. I was just wondering if you can add a completely new
header instead of reusing the "From".

If not, does changing this header information have any detrimental side
effects and if so what headers would be alright to change?



"Dmitry Streblechenko" <dmitry@dimastr.com> wrote in
news:uaWkyQ3vDHA.2360@TK2MSFTNGP10.phx.gbl:

> If you send in the RTF format, only Outlook users will be able to read
> the data correctly - you will get the infamous winmail.dat attachment.
> The only workaround is to add custom headers to the message header
> using Extended MAPI, CDO 1.21 or Redemption:
> http://www.dimastr.com/redemption/faq.htm#14
> The sample sets the Sender header, but it can be used to add any other
> header.
> On the receiving side you can access PR_TRANSPORT_MESSAGE_HEADERS
> property and see if your header is there.
>
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
>

  Reply With Quote
Old 11-12-2003, 01:03 AM   #8
Dmitry Streblechenko
Guest
 
Posts: n/a
Default Re: Persistent MAPI Properties

It can be anything you want, just replace "Sender" with
"X-My-Coolest-Header".

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


"Andrew" <junk@digitaldetonator.com> wrote in message
news:Xns944DB39AAEAB0junkdigitaldetonator@207.46.248.16...
> When you do this, do you have to use a pre-exisitng header? The example
> you gave works fine. I was just wondering if you can add a completely new
> header instead of reusing the "From".
>
> If not, does changing this header information have any detrimental side
> effects and if so what headers would be alright to change?
>
>
>
> "Dmitry Streblechenko" <dmitry@dimastr.com> wrote in
> news:uaWkyQ3vDHA.2360@TK2MSFTNGP10.phx.gbl:
>
> > If you send in the RTF format, only Outlook users will be able to read
> > the data correctly - you will get the infamous winmail.dat attachment.
> > The only workaround is to add custom headers to the message header
> > using Extended MAPI, CDO 1.21 or Redemption:
> > http://www.dimastr.com/redemption/faq.htm#14
> > The sample sets the Sender header, but it can be used to add any other
> > header.
> > On the receiving side you can access PR_TRANSPORT_MESSAGE_HEADERS
> > property and see if your header is there.
> >
> > Dmitry Streblechenko (MVP)
> > http://www.dimastr.com/
> > OutlookSpy - Outlook, CDO
> > and MAPI Developer Tool
> >



  Reply With Quote
Old 14-12-2003, 07:58 AM   #9
Andrew
Guest
 
Posts: n/a
Default Re: Persistent MAPI Properties

This seems to work except that it seems that some mail servers modify the
text of my header values. It is most often the addition of a carriage
return, a newline, and a tab (Ascii values 13, 10, 9). Sometimes it is
only a carriage return, and newline. There does not seem to be any
pattern to where this occurs.

How do I prevent this from happening since it makes parsing these strings
problematic?

"Dmitry Streblechenko" <dmitry@dimastr.com> wrote in
news:ucmqeK4vDHA.2440@TK2MSFTNGP12.phx.gbl:

> It can be anything you want, just replace "Sender" with
> "X-My-Coolest-Header".
>
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
>

  Reply With Quote
Old 14-12-2003, 07:43 PM   #10
Dmitry Streblechenko
Guest
 
Posts: n/a
Default Re: Persistent MAPI Properties

If the header+value length exceeds 72 chars, the line must be wrapped
around, this is just an RFC 822 requirement.
To unwrap, read the next line and check if the first character is space or
tab.

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


"Andrew" <junk@digitaldetonator.com> wrote in message
news:Xns94519E5FBE62junkdigitaldetonator@207.46.248.16...
> This seems to work except that it seems that some mail servers modify the
> text of my header values. It is most often the addition of a carriage
> return, a newline, and a tab (Ascii values 13, 10, 9). Sometimes it is
> only a carriage return, and newline. There does not seem to be any
> pattern to where this occurs.
>
> How do I prevent this from happening since it makes parsing these strings
> problematic?
>
> "Dmitry Streblechenko" <dmitry@dimastr.com> wrote in
> news:ucmqeK4vDHA.2440@TK2MSFTNGP12.phx.gbl:
>
> > It can be anything you want, just replace "Sender" with
> > "X-My-Coolest-Header".
> >
> > Dmitry Streblechenko (MVP)
> > http://www.dimastr.com/
> > OutlookSpy - Outlook, CDO
> > and MAPI Developer Tool
> >



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off