PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook VBA Programming Custom Contact Form Questions

Reply

Custom Contact Form Questions

 
Thread Tools Rate Thread
Old 28-02-2005, 04:42 PM   #1
tguenther@hotmail.com
Guest
 
Posts: n/a
Default Custom Contact Form Questions


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.

  Reply With Quote
Old 01-03-2005, 04:49 AM   #2
Helmut Sempf
Guest
 
Posts: n/a
Default Re: Custom Contact Form Questions

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


<tguenther@hotmail.com> schrieb im Newsbeitrag
news:1109608930.659491.103700@g14g2000cwa.googlegroups.com...
> 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.
>



  Reply With Quote
Old 01-03-2005, 02:09 PM   #3
Sue Mosher [MVP-Outlook]
Guest
 
Posts: n/a
Default Re: Custom Contact Form Questions

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/newdef...m#changedefault .

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"Helmut Sempf" <info@sempf.de> wrote in message
news:4223f4ca$0$921$afc38c87@news.easynet.de...
> 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
>
>
> <tguenther@hotmail.com> schrieb im Newsbeitrag
> news:1109608930.659491.103700@g14g2000cwa.googlegroups.com...
>> 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.
>>

>
>



  Reply With Quote
Old 01-03-2005, 09:33 PM   #4
Helmut Sempf
Guest
 
Posts: n/a
Default Re: Custom Contact Form Questions

Hi Sue,

thanx for correcting that!

Helmut Sempf, Outlook novice
Reader of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx




  Reply With Quote
Old 02-03-2005, 02:41 PM   #5
Sue Mosher [MVP-Outlook]
Guest
 
Posts: n/a
Default Re: Custom Contact Form Questions

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.

--
Sue Mosher, Outlook MVP
Frustrated author of
Configuring Microsoft Outlook 2003
to be published when I finally get it finished.


"Helmut Sempf" <info@sempf.de> wrote in message
news:4224dfba$0$16491$afc38c87@news.easynet.de...
> Hi Sue,
>
> thanx for correcting that!
>
> Helmut Sempf, Outlook novice
> Reader of
> Microsoft Outlook Programming - Jumpstart for
> Administrators, Power Users, and Developers
> http://www.outlookcode.com/jumpstart.aspx
>
>
>
>



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off