A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Set a Non-Standard Form as the Default Form in a Folder with VBA



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old November 7th 06, 10:31 AM posted to microsoft.public.outlook.program_vba
Dirk
external usenet poster
 
Posts: 7
Default Set a Non-Standard Form as the Default Form in a Folder with VBA

Hi. We have to handle a huge amount of public contactfolders. Now we created
a new contactform and want to change the existing contactitems to this form.
So I wrote a VBA-Script, which changes the messageclass of all items in a
folder and all subfolders. This works fine, but with the same script I want
to set the new form as the default form in all the subfolders. This doesn't
work, because I can't find the right property of the public folder. I'm using
the MAPIFolder object. Is this the right one?

Ads
  #2  
Old November 7th 06, 03:37 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Set a Non-Standard Form as the Default Form in a Folder with VBA

MAPIFolder is the correct object, but the property you need to set isn't
exposed in the Outlook object model. You need to set PR_DEF_POST_MSGCLASS
(0x36E5001E), PR_DEF_POST_DISPLAYNAME (0x36E6001E) PT_STRING8 properties

PR_DEF_POST_MSGCLASS gets set to the MessageClass you want as the default
and PR_DEF_POST_DISPLAYNAME gets set to the display name of that form.

You will need to use a lower level API such as CDO 1.21 or Extended MAPI
(C++ or Delphi only) or Redemption (www.dimastr.com/redemption) to do what
you want.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Dirk" wrote in message
...
Hi. We have to handle a huge amount of public contactfolders. Now we
created
a new contactform and want to change the existing contactitems to this
form.
So I wrote a VBA-Script, which changes the messageclass of all items in a
folder and all subfolders. This works fine, but with the same script I
want
to set the new form as the default form in all the subfolders. This
doesn't
work, because I can't find the right property of the public folder. I'm
using
the MAPIFolder object. Is this the right one?


  #3  
Old November 7th 06, 05:25 PM posted to microsoft.public.outlook.program_vba
Dirk
external usenet poster
 
Posts: 7
Default Set a Non-Standard Form as the Default Form in a Folder with V

Hi Ken,
thanks for your answer. I never used these lower level APIs before, so I
have to find out how to use them in VBA. Would be nice, if anyone has helpful
hints.


"Ken Slovak - [MVP - Outlook]" wrote:

MAPIFolder is the correct object, but the property you need to set isn't
exposed in the Outlook object model. You need to set PR_DEF_POST_MSGCLASS
(0x36E5001E), PR_DEF_POST_DISPLAYNAME (0x36E6001E) PT_STRING8 properties

PR_DEF_POST_MSGCLASS gets set to the MessageClass you want as the default
and PR_DEF_POST_DISPLAYNAME gets set to the display name of that form.

You will need to use a lower level API such as CDO 1.21 or Extended MAPI
(C++ or Delphi only) or Redemption (www.dimastr.com/redemption) to do what
you want.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Dirk" wrote in message
...
Hi. We have to handle a huge amount of public contactfolders. Now we
created
a new contactform and want to change the existing contactitems to this
form.
So I wrote a VBA-Script, which changes the messageclass of all items in a
folder and all subfolders. This works fine, but with the same script I
want
to set the new form as the default form in all the subfolders. This
doesn't
work, because I can't find the right property of the public folder. I'm
using
the MAPIFolder object. Is this the right one?



  #4  
Old November 7th 06, 08:15 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Set a Non-Standard Form as the Default Form in a Folder with V

With VBA you can forget about Extended MAPI, it's only C++ and Delphi.

CDO is an optional installation for Outlook, it's on the Office CD's.
Redemption is a third party library.

This is what it would look like in CDO code:

'assuming you have CDO installed and a reference set to Microsoft CDO 1.21
Library (CDO.DLL)
' also assuming a folder olFolder has been instantiated:

Dim Folder As MAPI.Folder
Dim oSession As MAPI.Session

Const PR_DEF_POST_MSGCLASS = &H36E5001E
Const PR_DEF_POST_DISPLAYNAME = &H36E6001E

Set oSession = CreateObject("MAPI.Session")
oSession.Logon "", "", False, False

Set oFolder = oSession.GetFolder(olFolder.EntryID, olFolder.StoreID)

If IsEmpty(oFolder.Fields(PR_DEF_POST_MSGCLASS)) Then
oFolder.Fields.Add(PR_DEF_POST_MSGCLASS, "IPM.Contact.MyContact")
Else
oFolder.Fields(PR_DEF_POST_MSGCLASS).Value = "IPM.Contact.MyContact"
End If

If IsEmpty(oFolder.Fields(PR_DEF_POST_DISPLAYNAME)) Then
oFolder.Fields.Add(PR_DEF_POST_DISPLAYNAME, "My Contact Form")
Else
oFolder.Fields(PR_DEF_POST_DISPLAYNAME).Value = "My Contact Form"
End If

oFolder.Update 'save

oSession.Logoff

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Dirk" wrote in message
...
Hi Ken,
thanks for your answer. I never used these lower level APIs before, so I
have to find out how to use them in VBA. Would be nice, if anyone has
helpful
hints.


  #5  
Old November 8th 06, 09:21 AM posted to microsoft.public.outlook.program_vba
Dirk
external usenet poster
 
Posts: 7
Default Set a Non-Standard Form as the Default Form in a Folder with V

Hi Ken,
thanks a lot. It works. You're great!
Greets,
Dirk

"Ken Slovak - [MVP - Outlook]" wrote:

With VBA you can forget about Extended MAPI, it's only C++ and Delphi.

CDO is an optional installation for Outlook, it's on the Office CD's.
Redemption is a third party library.

This is what it would look like in CDO code:

'assuming you have CDO installed and a reference set to Microsoft CDO 1.21
Library (CDO.DLL)
' also assuming a folder olFolder has been instantiated:

Dim Folder As MAPI.Folder
Dim oSession As MAPI.Session

Const PR_DEF_POST_MSGCLASS = &H36E5001E
Const PR_DEF_POST_DISPLAYNAME = &H36E6001E

Set oSession = CreateObject("MAPI.Session")
oSession.Logon "", "", False, False

Set oFolder = oSession.GetFolder(olFolder.EntryID, olFolder.StoreID)

If IsEmpty(oFolder.Fields(PR_DEF_POST_MSGCLASS)) Then
oFolder.Fields.Add(PR_DEF_POST_MSGCLASS, "IPM.Contact.MyContact")
Else
oFolder.Fields(PR_DEF_POST_MSGCLASS).Value = "IPM.Contact.MyContact"
End If

If IsEmpty(oFolder.Fields(PR_DEF_POST_DISPLAYNAME)) Then
oFolder.Fields.Add(PR_DEF_POST_DISPLAYNAME, "My Contact Form")
Else
oFolder.Fields(PR_DEF_POST_DISPLAYNAME).Value = "My Contact Form"
End If

oFolder.Update 'save

oSession.Logoff

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Dirk" wrote in message
...
Hi Ken,
thanks for your answer. I never used these lower level APIs before, so I
have to find out how to use them in VBA. Would be nice, if anyone has
helpful
hints.



 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing the default form for a contact folder Sue Mosher [MVP-Outlook] Outlook - Using Forms 15 May 6th 08 04:29 PM
How to replace Default Contact form with Customised conact form using VBScript code Satish Boddapati Outlook - Using Contacts 0 October 12th 06 09:20 AM
How to replace Default Contact form with Customised conact form using VBScript code Satish Boddapati Outlook - Installation 0 October 12th 06 09:19 AM
How to use a custom form as a default folder form ? David Outlook - Using Forms 14 July 17th 06 07:14 AM
OL 2007 - Set custom form region as default Fidget Brain Outlook - Using Forms 8 July 6th 06 04:36 PM


All times are GMT +1. The time now is 12:03 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.