PR_MESSAGE_CLASS is reset when calling Save() on item

  • Thread starter Thread starter Tobias Böhm
  • Start date Start date
T

Tobias Böhm

Hello,

I'm having several problems with my Outlook-Add-In and I would
appreciate any help on this one.
To show a custom icon for items of a certain folder I set the
PR_MESSAGE_CLASS to the message class I created and the PR_ICON_INDEX
to -1. Then because of the -1 a custom icon is shown and because of
the custom message class it's the one I defined in the custom form.
Very good.

The problem starts when the user updates the item, either with an
outlook inspector or with my custom windows form. After displaying the
data in my custom windows form I persist the values, I write them back
to the outlook item and call .Save(). That resets the MessageClass
which is very odd I think because the item is not moved or something -
I just saved it.

Is this behaviour known or even wanted and if so, why?
Thank you in advance for any help.

Tobi
 
This behaviour can simply be reproduced by creating a custom form,
creating a folder and tell outlook to use the custom form. Create
item, everything is fine. Restart outlook, open one of the items, save
and the PR_MESSAGE_CLASS is gone. Oddly, outlook still opens the item
with the correct (custom) form even though there is no information
anywhere anymore that this is not a standard item.

Is this just my outlook acting weird or am I doing something wrong?

Thank you in advance.
Tobi
 
Is that custom form with that MessageClass published in Outlook? It sounds
like the form isn't published and the items are one-offed.

At any rate, just set the custom MessageClass again when the item is saved
and make sure the custom form is published.
 
Is that custom form with that MessageClass published in Outlook? It sounds
like the form isn't published and the items are one-offed.

At any rate, just set the custom MessageClass again when the item is saved
and make sure the custom form is published.

Thank you. After I designed the form I published (Outlook 07: "Publish
Form As") and gave an appropriate name. Then I right click on a folder
and assign that custom form to that particular folder. Then the
strange behaviour. I create an item, everything is fine. Opening,
saving, PR_MESSAGE_CLASS and the icon are correct. When I restart
Outlook the moment I save the item the PR_MESSAGE_CLASS and the icon
are gone. Strange, that can't be the desired behaviour, right? Funny
thing, Outlook still opens the item, even though there's nothing left
of my custom class, with that custim form.
I'm hacking the PR_MESSAGE_CLASS back in but that can't be it. Do you
mean a different kind of publishing?

Tobi
 
There's only one publishing that you'd use, Publish As and then selecting a
library (Personal or Organizational) or publishing to a folder. As long as
you only publish to one location and make sure to increment the Version
property of the form (a string but can be used as if an int value) things
are usually OK.

It's possible there's some form of forms cache corruption, that should be
eliminated first. Go to the Manage Forms dialog and click the button to
clear the cache. At that time make sure the form is published to the desired
location and no other.

The folder default form property just make sure your custom form is used to
create all new items in that folder.

About the only other thing I can think of is to examine one of the problem
items in a MAPI viewer such as OutlookSpy or MFCMAPI and see if you can spot
any differences between it and an item that's OK.

You aren't by any chance synching those items with some sort of PDA or IPod
or IPhone or other device? If so that might be the cause of the problem if
that synching software can't deal with custom form items and changes them
back to the standard MessageClass.




<snip>

Thank you. After I designed the form I published (Outlook 07: "Publish
Form As") and gave an appropriate name. Then I right click on a folder
and assign that custom form to that particular folder. Then the
strange behaviour. I create an item, everything is fine. Opening,
saving, PR_MESSAGE_CLASS and the icon are correct. When I restart
Outlook the moment I save the item the PR_MESSAGE_CLASS and the icon
are gone. Strange, that can't be the desired behaviour, right? Funny
thing, Outlook still opens the item, even though there's nothing left
of my custom class, with that custim form.
I'm hacking the PR_MESSAGE_CLASS back in but that can't be it. Do you
mean a different kind of publishing?

Tobi
 
Back
Top