You can do that, but not using the Outlook object model. Each custom form
published in the Personal Forms library lives as a hidden message in the
hidden Common Views folder with a MessageClass of
"IPM.Microsoft.FolderDesign.FormsDescription". MAPI property 0x6800001E has
the custom message class of the form as a string property.
This requires coding in CDO 1.21 (optional installation for Outlook 2000 and
later) or Extended MAPI (C++ or Delphi only) to get at the Common Views
folder.
CDO code would look something like this when run from within Outlook (so an
Outlook session is already established). This code requires a project
reference to be set to CDO.DLL which is CDO 1.21:
Dim oSession As MAPI.Session
Dim oInbox As MAPI.Folder
Dim oRoot As MAPI.Folder
Dim oStore As MAPI.InfoStore
Dim oViews As MAPI.Folder
Dim oMessage As MAPI.Message
Dim oFolders As MAPI.Folders
Dim oMessages As MAPI.Messages
Dim sMessageClass As String
Set oSession = CreateObject("MAPI.Session")
oSession.Logon "", "", False, False
Set oInbox = oSession.Inbox
Set oStore = oSession.GetInfoStore(oInbox.StoreID)
Set oRoot = oStore.RootFolder
Set oFolders = oRoot.Folders
'for Outlook 2003 use "IPM_Common_Views" instead
Set oView = oFolders.Item("Common Views")
Set oMessages = oView.HiddenMessages
For Each oMessage In oMessages
If oMessage.Type = "IPM.Microsoft.FolderDesign.FormsDescription" Then
sMessageClass = oMessage.Fields(&H6800001E)
If sMessageClass = "IPM.Note.xxx" Then
oMessage.Delete
Exit For
End If
Next
oSession.Logoff
'now set all objects = Nothing