![]() |
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. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
hello
I've customized post form in OL2007,published it to a folder (under personal folders) & now want to make it as default form.So when user clicks new ,my custom form get displayed instead of default one.The problem is that - form gets published properly to the folder but I'm unable to set it default so that my custom form can be displayed when new is clicked. I'm using below code for making my custom form default when new is clicked- Private Sub SetDefaultFormFolder(ByVal fld As Outlook.MAPIFolder, ByVal FormClass As String, ByVal formName As String) On Error GoTo err_handle Dim cdoFld As Object ' MAPI.Folder Dim cdoSession As Object ' MAPI.Session Dim fld1 As Object 'MAPI.Field Dim fld2 As Object 'MAPI.Field Dim fld3 As Object Const PR_DEF_POST_MSGCLASS = &H36E5001E Const PR_DEF_POST_DISPLAYNAME = &H36E6001E Const PR_DEF_FORM_ALLOWED = &H3FE20003 'Allow these forms in this folder: cdoSession = CreateObject("MAPI.Session") cdoSession.Logon("", "", False, False) cdoFld = cdoSession.GetFolder(fld.EntryID, fld.StoreID) If Not cdoFld Is Nothing Then On Error Resume Next fld1 = cdoFld.Fields(PR_DEF_POST_MSGCLASS) If fld1 Is Nothing Then fld1 = cdoFld.Fields.Add(PR_DEF_POST_MSGCLASS, vbString) fld1.Value = FormClass fld2 = cdoFld.Fields(PR_DEF_POST_DISPLAYNAME) If fld2 Is Nothing Then fld2 = cdoFld.Fields.Add(PR_DEF_POST_DISPLAYNAME, vbString) fld2.Value = formName If fld3 Is Nothing Then fld3 = cdoFld.Fields.Add(PR_DEF_FORM_ALLOWED, vbString) fld3.Value = 1 On Error GoTo 0 cdoFld.Update(True, True) End If cdoSession.Logoff() cdoSession = Nothing fld1 = Nothing fld2 = Nothing cdoFld = Nothing Exit Sub err_handle: Dim stt As String stt = "Error in setting default form folder - " & fld.Name & vbCrLf & "Error " & Err.Number & "-" & Err.Description End Sub Thanks |
Ads |
#2
|
|||
|
|||
![]()
You don't need CDO to do this in Outlook 2007. Instead, you can use the new
PropertyAccessor object. See http://www.outlookcode.com/codedetail.aspx?id=1594 for a code sample taken from my book. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "sd" wrote: hello I've customized post form in OL2007,published it to a folder (under personal folders) & now want to make it as default form.So when user clicks new ,my custom form get displayed instead of default one.The problem is that - form gets published properly to the folder but I'm unable to set it default so that my custom form can be displayed when new is clicked. I'm using below code for making my custom form default when new is clicked- Private Sub SetDefaultFormFolder(ByVal fld As Outlook.MAPIFolder, ByVal FormClass As String, ByVal formName As String) On Error GoTo err_handle Dim cdoFld As Object ' MAPI.Folder Dim cdoSession As Object ' MAPI.Session Dim fld1 As Object 'MAPI.Field Dim fld2 As Object 'MAPI.Field Dim fld3 As Object Const PR_DEF_POST_MSGCLASS = &H36E5001E Const PR_DEF_POST_DISPLAYNAME = &H36E6001E Const PR_DEF_FORM_ALLOWED = &H3FE20003 'Allow these forms in this folder: cdoSession = CreateObject("MAPI.Session") cdoSession.Logon("", "", False, False) cdoFld = cdoSession.GetFolder(fld.EntryID, fld.StoreID) If Not cdoFld Is Nothing Then On Error Resume Next fld1 = cdoFld.Fields(PR_DEF_POST_MSGCLASS) If fld1 Is Nothing Then fld1 = cdoFld.Fields.Add(PR_DEF_POST_MSGCLASS, vbString) fld1.Value = FormClass fld2 = cdoFld.Fields(PR_DEF_POST_DISPLAYNAME) If fld2 Is Nothing Then fld2 = cdoFld.Fields.Add(PR_DEF_POST_DISPLAYNAME, vbString) fld2.Value = formName If fld3 Is Nothing Then fld3 = cdoFld.Fields.Add(PR_DEF_FORM_ALLOWED, vbString) fld3.Value = 1 On Error GoTo 0 cdoFld.Update(True, True) End If cdoSession.Logoff() cdoSession = Nothing fld1 = Nothing fld2 = Nothing cdoFld = Nothing Exit Sub err_handle: Dim stt As String stt = "Error in setting default form folder - " & fld.Name & vbCrLf & "Error " & Err.Number & "-" & Err.Description End Sub Thanks |
#3
|
|||
|
|||
![]()
Thanks Sue
I tried with the code you suggested.But still no success.When I checked Folder properties ,my custom form is listed in "When Posting to this folder" dropdown list as well as on forms tab "Forms Associated with this folder".But the radio button "Only forms listed above" is greyed.Is this radio button is required so that when user clicks new ,my custom post form gets displayed? If so ,how to enable it & select it programmatically? The folder type is Mail& post.Folder is in Personal folders hierarchy.Also my custom form is the only form listed on forms tab of properties dialog. |
#4
|
|||
|
|||
![]()
The "only forms listed above option" is not applicable to folders in a .pst
file. The user will need to click New Post in This Folder to see your form. When a Mail/Post folder is displayed, the New button creates a new message, not a new post in the folder. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "sd" wrote: Thanks Sue I tried with the code you suggested.But still no success.When I checked Folder properties ,my custom form is listed in "When Posting to this folder" dropdown list as well as on forms tab "Forms Associated with this folder".But the radio button "Only forms listed above" is greyed.Is this radio button is required so that when user clicks new ,my custom post form gets displayed? If so ,how to enable it & select it programmatically? The folder type is Mail& post.Folder is in Personal folders hierarchy.Also my custom form is the only form listed on forms tab of properties dialog. |
#5
|
|||
|
|||
![]()
Thanks Sue
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
problem with publish custom Post form | shubhangi | Add-ins for Outlook | 6 | February 18th 08 02:12 PM |
Make a form Default | Henry Roif | Outlook - Using Forms | 1 | May 17th 07 01:14 PM |
2002 outlook, how do i make my custom contact form my default | Linda | Outlook - Using Contacts | 1 | June 23rd 06 12:56 AM |
RecipientControl in Post custom form | Bill | Outlook - Using Forms | 1 | May 11th 06 07:32 PM |
Auto Number in a Custom Post Form | Chuck Rich | Outlook - Using Forms | 1 | February 13th 06 06:28 PM |