messageclass change doesn't change icon

J

James

Our company uses a contact based custom form. The icon for this form
is the standard Note or post icon.

I wrote some macro code so that when a regular contact is selected and
the code run, it will change the contact's messageclass to our custom
form.

The code works in the that the class gets changed, but the icon
remains the standard contact icon.

Why doesn't the icon change? And how can I fix this?

THx,

J.

Code
-----------------

Sub ClassChanger()

Dim myItem
Dim objApp

Set objApp = CreateObject("Outlook.Application")
Set myItem = objApp.ActiveExplorer.Selection.Item(1)
myItem.MessageClass = "IPM.Contact.Contact Form"
myItem.Save

Set myItem = Nothing
Set objApp = Nothing

End Sub
 
J

James

I found the 'Outlook 2000 Existing Items Converter' COM add-in from
the Resource Kit, and when I run it, it works perfectly - it also
changes the icon properly.

So what is it doing that my code isn't? As it's a COM add-in, I don't
know how to view the source code.

Please help!

Thx,

J.
 
J

James

Ok, the existing items converter program doesn't work either. I
thought it did at first, but further testing shows I get the same
behaviour.

What my testing has shown is that - There is no way to inherit the
icon of a custom form when changing an item's message class to match.
It will always default to the parent class's icon. Opening the item in
design mode and checking the Properties tab shows what the large and
small icons should be - but in Outlook's list view it shows the
default icon instead. Exiting Outlook and going back in does not
change it either.

I've verified the forms are not being one-offed, I don't send the form
definition with the icon. The forms are published to a Public Folder.

Can someone please answer what the hell is going on?

J.
 
S

Sue Mosher [MVP-Outlook]

I do it all the time. Maybe you've one-offed the items? Compare the item
size with contacts created without a custom form.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
J

James

Hi Sue,

They are not being one offed.....size remains the same and is small
(400B).

I just did the following:

- Created a new public folder containing 'contact items'
- Created a new contact based form (I just added a command button to
the main page) which uses the default Post icon
- I published the form to the Public Folder
- I did not Save it when asked to
- I changed the 'when posting to this folder' entry to my new form
- I created a new entry, and verified it was using the form and the
entry used the post icon
- I dragged a regular contact into that folder
- I clicked on the contact and ran the macro code to change the class
- The icon remained the default contact icon
- I opened up the contact and verified the class was changed (had the
command button)
- I exited Outlook and went back in and the contact still had the
regular contact icon

If I modify the code to change the class to a standard contact
(IPM.Contact) and run it on one of the custom form entries the icon
changes to the standard contact icon right away. If I run code on the
same entry to change it to my custom form it reverts back to the Post
icon. BUT, if I do the same procedure on any regular contact that I
changed the MessageClass on, the icon never changes. It always shows
the default contact icon.

I am using Exchange 5.5 SP4, and Outlook XP SP3.

J.
 
J

James

Sue,

Can you duplicate this behaviour?

J.

Hi Sue,

They are not being one offed.....size remains the same and is small
(400B).

I just did the following:

- Created a new public folder containing 'contact items'
- Created a new contact based form (I just added a command button to
the main page) which uses the default Post icon
- I published the form to the Public Folder
- I did not Save it when asked to
- I changed the 'when posting to this folder' entry to my new form
- I created a new entry, and verified it was using the form and the
entry used the post icon
- I dragged a regular contact into that folder
- I clicked on the contact and ran the macro code to change the class
- The icon remained the default contact icon
- I opened up the contact and verified the class was changed (had the
command button)
- I exited Outlook and went back in and the contact still had the
regular contact icon

If I modify the code to change the class to a standard contact
(IPM.Contact) and run it on one of the custom form entries the icon
changes to the standard contact icon right away. If I run code on the
same entry to change it to my custom form it reverts back to the Post
icon. BUT, if I do the same procedure on any regular contact that I
changed the MessageClass on, the icon never changes. It always shows
the default contact icon.

I am using Exchange 5.5 SP4, and Outlook XP SP3.

J.
 
S

Sue Mosher [MVP-Outlook]

Thanks for the detailed steps, which repro here in Outlook 2002 SP3. I can
make sure the right folks at Microsoft know about it, but that doesn't mean
it will be fixed any time soon.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
J

James

Ok, I found the answer. I was correct. I found the docmessageclass app
off of outlookstore and it works perfectly! This was in the notes:

"Entries, which are created using a default MessageClass, retain their
original Icon after changing the MessageClass"

So I'm not insane :) However they include an option to 'reset the
icon'. When I run it, it does indeed set the icon to a Post icon. So
this can be done.

Now the question is how do you programatically change the icon for a
contact? While the docmessageclass app is great it's somewhat
unfriendly to a non-programmer.

Come on Sue, throw me a bone!

Thx,

J.
 
S

Sue Mosher [MVP-Outlook]

MVP David Kane jumped in off-forum to remind me that it can be done with
CDO. I'm working on a code sample to demonstrate, but am having problems, so
I don't know when that will be ready. In the meantime, here's David's input:

It's controlled by a MAPI property -- &H10800003, listed as PR_ICON_INDEX in
OutlookSpy but I think that might just be Dmitry's name for it. It gets set
to 512 when the item is created using a standard form, but it's -1 if you
create it using the custom form. To flip the displayed image change
MessageClass and set PR_ICON_INDEX to -1

I was able to confirm with Outlook Spy that changing that property does the
trick. If you're not familiar with using MAPI properties in CDO or
Redemption code, see http://www.cdolive.com/cdo10.htm
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top