Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming Add-Ins / July 2009

Tip: Looking for answers? Try searching our database.

PR_MESSAGE_CLASS is reset when calling Save() on item

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tobias Böhm - 30 Jul 2009 08:10 GMT
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
Tobias Böhm - 30 Jul 2009 11:52 GMT
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
Ken Slovak - [MVP - Outlook] - 30 Jul 2009 14:14 GMT
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.

Signature

Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm

> This behaviour can simply be reproduced by creating a custom form,
> creating a folder and tell outlook to use the custom form. Create
[quoted text clipped - 7 lines]
> Thank you in advance.
> Tobi
Tobias Böhm - 30 Jul 2009 17:42 GMT
On 30 Jul., 15:14, "Ken Slovak - [MVP - Outlook]" <kenslo...@mvps.org>
wrote:
> Is that custom form with that MessageClass published in Outlook? It sounds
> like the form isn't published and the items are one-offed.
[quoted text clipped - 19 lines]
> > Thank you in advance.
> > Tobi

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
Ken Slovak - [MVP - Outlook] - 30 Jul 2009 19:24 GMT
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.

Signature

Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm

<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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.