Make custom post form default

S

sd

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
 
S

sd

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.
 
S

Sue Mosher [MVP-Outlook]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top