changing the class doesn't change the icon!

L

lee.james

We've created a custom contact form, it basically adds a new tab and
some new fields we use for sorting....the custom contacts reside in a
public folder. (we're using Outlook 2000/2003, Exchange 2003).

Secretaries will use a card scanner to scan in new contacts which then
reside in a local folder.

We want to then place those scanned in contacts into the Public folder
but convert them to use our custom form.

I wrote a macro that does exactly that and it works fine. BUT it
doesn't change the icon, it still shows as the regular Contact icon
instead of the Post icon.

So what? Well quite often our sales guys will just drag some of their
contacts into the Public folder. By sorting on the icon we can quickly
determine which contacts are not using the custom form.

So how (using vbscript) can I programmatically change the icon?

J.
 
S

Sue Mosher [MVP-Outlook]

You can't change the icon directly. The icon comes from the MessageClass property of the item, which tells the item which form to use. Have you checked the value of MessageClass on some actual items?

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
L

lee.james

Hi Sue,

Yes I added the MessageClass 'header' from the Field Chooser and it
verifies it's using the new form properly.

I actually came across a posting of mine (and your response) from a few
years ago. It turns out I need to use CDO and the &H10800003, listed as
PR_ICON_INDEX, properties. I need to make it -1.

Great, I've scoured through a bunch of code samples but can't make
sense of things.

Here's my code:

Sub CardScanConverter()

' CardScan Converter by James Lee
' v1.1 Nov 8, 04

Dim ContactItem
Dim objApp
Dim objNS
Dim objSrcFolder
Dim objFolder
Dim objSrcItem
Dim FormItem
Dim dlgResult
Dim intCounter

Set objApp = CreateObject("Outlook.Application")
Set objNS = Application.GetNamespace("MAPI")
Set objFolder = objNS.GetDefaultFolder(olFolderContacts)

On Error Resume Next
Set objSrcFolder = objFolder.Folders("CardScan")

If Err.Number = "-2147221233" Then
MsgBox "CardScan folder is missing or has been moved",
vbCritical
Exit Sub
End If

Set objSrcItem = objSrcFolder.Items

If objSrcItem.Count <> 0 Then
For Each Item In objSrcItem
Item.MessageClass = "IPM.Contact.Contact Form"

' I need something like Item.Fields(&H10800003) = -1

Item.Save
Next Item
MsgBox "Contact(s) successfully converted", vbInformation
Else
MsgBox "CardScan folder is empty", vbExclamation
End If

Set ContactItem = Nothing
Set objApp = Nothing
Set objNS = Nothing
Set objSrcFolder = Nothing
Set objFolder = Nothing
Set objSrcItem = Nothing
Set FormItem = Nothing
Set dlgResult = Nothing
Set intCounter = Nothing

End Sub
 

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