K
Kristy
Hi
I have set up some custom forms that contain standard text (and
sometimes graphics) to be used in generic emails/replies/forwards, it
would be really great if I could use something like the below example,
to enable users to choose which standard form they want to use in the
quickest, easiest way possible.
The function below is great I have used it sucessfully on customers in
the past however going forward I do not want to have to use CDO if I
can help it (headaches with installation etc). Therefore, I would like
to know if it would be possible to create this array of custom forms
using extended MAPI and Redemption? I also don't want invoke any
security warnings (or have to install the admin pack for my addins to
be trusted) so Redemption is what I'd like to use. Unfortunately my
experience with redemption and to a certain extend the Outlook object
model is still relatively small so can anyone tell me if this is
actually possible and maybe give me some tips on how to do it please?
Any advice would be greatly appreciated
'Code provided by MicroEye, CBItems example. This function enables me
to build a combobox which lists all the published forms in a folder.
'******************************************************************************
'Custom procedure: GetFormDescriptions(strEntryID, strStoreID)
'Purpose: Return a variant array containing custom forms in folder
'Argument: Outlook Entry ID, Store ID
'Usage:
'Set avarArray = GetFormDescriptions(objFolder.EntryID,
objFolder.StoreID)
'Returns: Variant Array
'******************************************************************************
Public Function GetFormDescriptions(strEntryID, strStoreID) As Variant
Dim objFolder As MAPI.Folder
Dim objMsgFilter As MAPI.MessageFilter
Dim colHiddenMsgs As MAPI.Messages
Dim objHiddenMsg As MAPI.Message
Dim avarArray As Variant
Dim intCount, intLoop As Integer
'MAPI Properties for FormDescription Hidden Messages
Const PR_HIDDEN_FORM = &H6803001E
Const PR_FORM_MESSAGECLASS = &H6800001E
Set objFolder = gobjCDO.GetFolder(strEntryID, strStoreID)
Set colHiddenMsgs = objFolder.HiddenMessages
'colHiddenMsgs.Sort CdoAscending, CdoPR_DISPLAY_NAME
If colHiddenMsgs.Count Then
'Set a filter on messages collection
Set objMsgFilter = colHiddenMsgs.Filter
objMsgFilter.Type = "IPM.Microsoft.FolderDesign.FormsDescription"
'Sort FormDescription collection on Display Name
colHiddenMsgs.Sort CdoAscending, CdoPR_DISPLAY_NAME
If colHiddenMsgs.Count Then
'Count number of forms in folder excluding hidden forms
For Each objHiddenMsg In colHiddenMsgs
If Not (objHiddenMsg.Fields(PR_HIDDEN_FORM)) Then
intCount = intCount + 1
End If
Next
If intCount Then
'Dimension variant array to hold forms
ReDim avarArray(intCount - 1, 1)
For Each objHiddenMsg In colHiddenMsgs
If Not (objHiddenMsg.Fields(PR_HIDDEN_FORM)) Then
avarArray(intLoop, 0) = _
objHiddenMsg.Fields(CdoPR_DISPLAY_NAME)
avarArray(intLoop, 1) = _
objHiddenMsg.Fields(PR_FORM_MESSAGECLASS)
intLoop = intLoop + 1
End If
Next
GetFormDescriptions = avarArray
Else
GetFormDescriptions = Empty
End If
Else
GetFormDescriptions = Empty
End If
End If
End Function
Cheers
Kris
I have set up some custom forms that contain standard text (and
sometimes graphics) to be used in generic emails/replies/forwards, it
would be really great if I could use something like the below example,
to enable users to choose which standard form they want to use in the
quickest, easiest way possible.
The function below is great I have used it sucessfully on customers in
the past however going forward I do not want to have to use CDO if I
can help it (headaches with installation etc). Therefore, I would like
to know if it would be possible to create this array of custom forms
using extended MAPI and Redemption? I also don't want invoke any
security warnings (or have to install the admin pack for my addins to
be trusted) so Redemption is what I'd like to use. Unfortunately my
experience with redemption and to a certain extend the Outlook object
model is still relatively small so can anyone tell me if this is
actually possible and maybe give me some tips on how to do it please?
Any advice would be greatly appreciated
'Code provided by MicroEye, CBItems example. This function enables me
to build a combobox which lists all the published forms in a folder.
'******************************************************************************
'Custom procedure: GetFormDescriptions(strEntryID, strStoreID)
'Purpose: Return a variant array containing custom forms in folder
'Argument: Outlook Entry ID, Store ID
'Usage:
'Set avarArray = GetFormDescriptions(objFolder.EntryID,
objFolder.StoreID)
'Returns: Variant Array
'******************************************************************************
Public Function GetFormDescriptions(strEntryID, strStoreID) As Variant
Dim objFolder As MAPI.Folder
Dim objMsgFilter As MAPI.MessageFilter
Dim colHiddenMsgs As MAPI.Messages
Dim objHiddenMsg As MAPI.Message
Dim avarArray As Variant
Dim intCount, intLoop As Integer
'MAPI Properties for FormDescription Hidden Messages
Const PR_HIDDEN_FORM = &H6803001E
Const PR_FORM_MESSAGECLASS = &H6800001E
Set objFolder = gobjCDO.GetFolder(strEntryID, strStoreID)
Set colHiddenMsgs = objFolder.HiddenMessages
'colHiddenMsgs.Sort CdoAscending, CdoPR_DISPLAY_NAME
If colHiddenMsgs.Count Then
'Set a filter on messages collection
Set objMsgFilter = colHiddenMsgs.Filter
objMsgFilter.Type = "IPM.Microsoft.FolderDesign.FormsDescription"
'Sort FormDescription collection on Display Name
colHiddenMsgs.Sort CdoAscending, CdoPR_DISPLAY_NAME
If colHiddenMsgs.Count Then
'Count number of forms in folder excluding hidden forms
For Each objHiddenMsg In colHiddenMsgs
If Not (objHiddenMsg.Fields(PR_HIDDEN_FORM)) Then
intCount = intCount + 1
End If
Next
If intCount Then
'Dimension variant array to hold forms
ReDim avarArray(intCount - 1, 1)
For Each objHiddenMsg In colHiddenMsgs
If Not (objHiddenMsg.Fields(PR_HIDDEN_FORM)) Then
avarArray(intLoop, 0) = _
objHiddenMsg.Fields(CdoPR_DISPLAY_NAME)
avarArray(intLoop, 1) = _
objHiddenMsg.Fields(PR_FORM_MESSAGECLASS)
intLoop = intLoop + 1
End If
Next
GetFormDescriptions = avarArray
Else
GetFormDescriptions = Empty
End If
Else
GetFormDescriptions = Empty
End If
End If
End Function
Cheers
Kris