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