Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

delete form from personal forms library

303 views
Skip to first unread message

Vadiraj

unread,
Jun 17, 2004, 2:15:52 AM6/17/04
to
Hi,
I have a form in my Personal forms library with a message
class "IPM.Note.xxx" and with a display name "xxx"

Can any body let me know how to programatically delete or
hide that form using vb code

If possible please send me the code snippet

Thanks in advance

Regards
Vadiraj

Vadiraj

unread,
Jun 17, 2004, 2:16:54 AM6/17/04
to

Ken Slovak - [MVP - Outlook]

unread,
Jun 17, 2004, 10:37:57 AM6/17/04
to
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

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Vadiraj" <vadira...@paconsulting.com> wrote in message
news:1d94201c45432$8a989550$a501...@phx.gbl...

Vadiraj

unread,
Jun 21, 2004, 6:08:21 AM6/21/04
to
Ken,
I tried ur code but it is not removing the form from
personal forms library
Please let me know what needs to be done in achieving the
same

Thanks and Regards
Vadiraj

>.
>

Ken Slovak - [MVP - Outlook]

unread,
Jun 21, 2004, 9:39:40 AM6/21/04
to
Are you getting any error messages? Did you try to debug the code and step
through it? Do you have CDO 1.21 installed (optional with Outlook 2000 and
later) and did you set a reference to CDO.DLL in your project? "Doesn't
work" doesn't tell us anything.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Vadiraj" <vadira...@paconsulting.com> wrote in message

news:1ee7101c45777$aea41490$a301...@phx.gbl...

Sue Mosher [MVP-Outlook]

unread,
Sep 13, 2004, 10:11:03 AM9/13/04
to
Ken, I have also been seeing odd things with the form removal code. It runs
without errors but the final For Each ... Next loop doesn't find any of the
forms that I see in IPM_COMMON_VIEWS in Outlook Spy. Instead, if I enumerate
all the items in that folder with a Debug.Print statement, all it finds are
three custom views, three views that I don't even see in IPM_COMMON_VIEWS.
From the symptoms, I'd say that oFolders.Item("IPM_COMMON_VIEWS") is opening
the wrong folder.

Can you think of any other way to return system folders from the root?

Ken Slovak - [MVP - Outlook]

unread,
Sep 13, 2004, 10:23:27 AM9/13/04
to
Hmm, how about using PR_COMMON_VIEWS_ENTRYID (0x35E60102) from IMsgStore
(InfoStore)? That should work and be language independent.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Sue Mosher [MVP-Outlook]" <sue...@outlookcode.com> wrote in message
news:32F21D3D-D569-4397...@microsoft.com...

Sue Mosher [MVP-Outlook]

unread,
Sep 13, 2004, 11:01:10 AM9/13/04
to
Works perfectly! Updated version posted at
http://www.outlookcode.com/codedetail.aspx?id=572. I imagine it will be not
just language-independent but version-independent as well, but I tested it
only for OL2003.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"Ken Slovak - [MVP - Outlook]" <kens...@mvps.org> wrote in message
news:eJl6i2Zm...@TK2MSFTNGP14.phx.gbl...


> Hmm, how about using PR_COMMON_VIEWS_ENTRYID (0x35E60102) from IMsgStore
> (InfoStore)? That should work and be language independent.

>

Ken Slovak - [MVP - Outlook]

unread,
Sep 13, 2004, 2:54:20 PM9/13/04
to
Excellent.

The property is there in OutlookSpy in Outlook 2000 and 2002 here. I'm not
running any earlier versions but it should be there too.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm

"Sue Mosher [MVP-Outlook]" <sue...@outlookcode.com> wrote in message

news:%23qSSqDa...@TK2MSFTNGP11.phx.gbl...

0 new messages