Custom Contact Form Questions

  • Thread starter Thread starter tguenther
  • Start date Start date
T

tguenther

Hi,

I have created a custom contact form and am trying to set it as the
default for certain contact folders. When I insert a new contact it
opens up my custom form, but when I double click on a contact I get the
default contact form from Outlook. Is there a way to always open up the
custom form either when adding or viewing the contacts in that folder?

I add the contact folders using VFP code. Is there a way to default the
folder to use the custom contact form from code? If not how do I set
the custom contact form as the default for all contact folders.

loOutlook = CREATEOBJECT("Outlook.Application")
*Get the MAPI namespace and find the contacts folder
loNamespace = loOutlook.GetNameSpace("MAPI")

*get the folder location to save the contacts
loFolder = loNameSpace.PickFolder

loFolder.folders.Add(tcFolder,olFolderContacts)

Thank you.
 
Try this:

Sub ChangeMessageClass()
Set olApp = New Outlook.Application
Set olNS = olApp.GetNameSpace("MAPI")
Set ContactsFolder = _
olNS.GetDefaultFolder(olFolderContacts)
Set ContactItems = ContactsFolder.Items
For Each Itm in ContactItems
If Itm.MessageClass <> "IPM.Contact.MyForm" Then
Itm.MessageClass = "IPM.Contact.MyForm"
Itm.Save
End If
Next
End Sub

This works only when your ContactItem is in the default folder. Otherwise
you
have to use the folder-list to get your specific folder.


with kind regards

Helmut Sempf
 
This code changes the message class for existing items, which is not what
the original poster was asking. They wanted to know how to set the message
class for a folder. That's done with CDO 1.21 using the PR_DEF_POST_MSGCLASS
(0x36E5001E) and PR_DEF_POST_DISPLAYNAME (0x36E6001E) properties. See
http://www.cdolive.com/cdo10.htm if you're not familiar with MAPI property
tags.

To make a custom form the default for all contacts requires a registry
change. See http://www.outlookcode.com/d/newdefaultform.htm#changedefault .

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

thanx for correcting that!

Helmut Sempf, Outlook novice
Reader of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
No problem! It's easy to get confused by all the different concepts of
default forms. I know it took me a while to sort it out in my little brain.

BTW, thanks for the chuckle.
 
Back
Top