| Code level: advanced Code area: Outlook Expert Techniques Printer Friendly Version | ||
| Title: Set the default form for a folder (OL2007) | ||
| Description: This VBA sample for Outlook 2007 uses the new PropertyAccessor object to set the default form for a folder. Call it by passing the folder and message class string (e.g. "IPM.Contact.MyForm") as arguments. For a version appropriate for earlier versions, see http://www.outlookcode.com/codedetail.aspx?id=1303. | ||
| Date: 07-May-2007 12:27 | ||
| Code level: advanced | ||
| Code area: Outlook Expert Techniques | ||
| Posted by: Sue Mosher | ||
| Body: |
||
| All 36comments |
| Page [ 1 2 3 4 Next >> ] | ||
|
|
Fabien
12-Oct-2007 03:08
Hello, I'm just started to customized OL2007 and I tried your function to set my new Contact Form as default... I didn't get it working yet :-( Could you be more specific regarding the call of this function? Where and how do I have to call it? Thanks for your help... |
|
|
|
Sue Mosher
12-Oct-2007 06:20
This is VBA code, so you would call it from a VBA macro, passing a Folder object and form message class string as arguments. |
|
|
|
Fabien
18-Oct-2007 01:57
That's what I did... I copied your function in Outlook's Macro und also created a new function in ThisOutlookSession called Application_Startup() which pass the contact folder to your function. But it's not working sofar... I'm not an expert with Macros and I would appriciate some help. Thank you in advance... |
|
|
|
Sue Mosher
18-Oct-2007 07:48
Does any VBA code run at all? Have you looked at the basics at http://outlookcode.com/article.aspx?id=49 ? What happens when you step through the code? If you comment out the On Error Resume Next statement, do you get any errors? Exactly how are you calling the function -- with what parameters? |
|
|
|
Fabien
22-Oct-2007 03:47
Thanks, looks like it's working now... But old contacts still open in the previous default window! Do you have any idea how to change the "contact window" for existing contacts? |
|
|
|
Sue Mosher
22-Oct-2007 07:30
Changing the default form for a folder has no effect on existing items. To change existing items so that they display using a published custom message form, you need to change the value of the MessageClass property on each item so that it points to the published form's class, e.g. IPM.Contact.MyForm. The page at http://www.outlookcode.com/article.aspx?id=39 has links to scripts and tools to do this. |
|
|
|
Selvam Paramasivan
03-Jul-2008 16:53
I tried to call this from VBScript and VB Executable to deploy new form to corporate users. After it successfully sets the form for calender it reports error saying "http://schemas.microsoft.com/mapi/proptag/0x36E5001E Error 5 - Invalid Procedure call or argument" I tried to debug the code and identified something goes wrong on arrErrors = objPA.SetProperties(arrSchema, arrValues) statement and control falls into Error condition. fails right Please help me on this. OL 2003 version works just fine. |
|
|
|
Sue Mosher
03-Jul-2008 17:27
Selvam, are you using this code with Outlook 2007? What folder are you trying to change? You can read more about the conditions under which SetProperties may raise an error at http://msdn.microsoft.com/en-us/library/bb207523.aspx . This article also shows how to check for errors after a SetProperties call. |
|
|
|
Selvam Paramasivan
05-Jul-2008 00:43
Sue, Thanks for prompt response. Yes I'm using the same code posted above to set Calender folder's default form. The form already got published into Organizational forms library. OL 2003 version code you have posted works just fine. But this one fails right at the SetProperties() call. I have "." as part of my form name. May be that cause this behavior. Thoughts please? FYI: I didn't change anything on the given code except to get correct form name (even if the form name has ".") I plan to try SetProperty rather than SetProperties and the other option I have is renaming the form name without period (.) on it. I refered the MSDN resource you have provided me but that didn't help much. Anyway I appreciate your help and the knowledge you share with community through outlookcode.com. Thanks! |
|
|
|
Sue Mosher
05-Jul-2008 09:48
Selvam, a custom form name must have not one but two periods in it, because it is always something like "IPM.Contact.MyForm" -- what form name are you using? |
|
| Page [ 1 2 3 4 Next >> ] | ||
| Post your comment name email |
