none
MAPI Custom Outlook Form installation and uninstallation RRS feed

  • Question

  • Hi, is there a way in .NET to do this?   Can someone point me to some good articles on this?  

    Thanks,

     

    Friday, January 13, 2012 7:21 PM

Answers

  • Yup, there's no capability to remove the published form.  All custom forms exist as items with a Message class of IPM.Microsoft.FolderDesign.FormsDescription.  You'd have to use MAPI or Redemption (recommended) to get a reference to the actual hidden message that represents the published form in the folder (note that forms published to the Personal Forms Library or stored in the top-level folder of the user's default store; with Redemption, use RDOFolder.HiddenItems to get the list of hidden messages).  However, there could be more than one form published in a library, so you'd have to differentiate them via the PR_DISPLAY_NAME property.

    Once you've obtained the item, then you can delete it (with Redemption, using RDOMailItem.Delete).  Note that I'm not 100% sure removing published forms with code is actually supported, but it should work.

    I'm also not sure how to remove or reference custom forms in the Organization Forms Library with code, but there has to be a way.


    Eric Legault
    MVP (Outlook)
    About me...
    • Marked as answer by alexkfh Friday, January 13, 2012 8:23 PM
    Friday, January 13, 2012 8:19 PM
    Moderator
  • I'm not sure, but I think you need to use ExOLEDB to delete it from the system mailbox - but that's outside the scope of this forum.  You can try asking in the Exchange Developers Forum.

    Otherwise, can you not just delete it from that dialog if you set the Organization Forms library to the right, select the form and click Delete?


    Eric Legault MVP (Outlook)
    About me...
    Try Outlook Appins - affordable and easy to use!

    • Marked as answer by alexkfh Thursday, November 8, 2012 10:46 PM
    Thursday, November 8, 2012 10:42 PM
    Moderator

All replies

  • Custom forms aren't installed the way desktop applications (or Outlook Add-ins) are installed (usually with Windows Installer).  They are published to forms libraries (Folder, Personal or Organization).

    Saving and Publishing Outlook Forms:
    http://www.outlookcode.com/article.aspx?id=34

    How to determine where to publish a custom Outlook form:
    http://support.microsoft.com/?kbid=290802


    Eric Legault
    MVP (Outlook)
    About me...
    Friday, January 13, 2012 7:23 PM
    Moderator
  • Thanks Eric, I understand this.  But i'm wondering if there is a way in VSTO/C# to do this?   Without going into the dirty details it's important for us to do this through .NET and not through C++ and MAPI.    Thanks,
    Friday, January 13, 2012 7:28 PM
  • Publishing forms has nothing to do with C++.  You can use the Outlook Object Model (which is really a high-level wrapper for MAPI) to publish your form.  Do this:

    • Save your custom form as an .oft file
    • Deploy that file with your solution
    • Use Application.CreateItemFromTemplate to get an item Object (e.g. MailItem) from your custom form (using the path to the .oft file deployed with your solution)
    • Get a FormDescription object from your item Object (e.g. from MailItem.FormDescription)
    • Call FormDescription.PublishForm, setting the Registry argument to the library you want to publish to (and use the Folder argument as well when publishing to a Folder Forms Library)

    Does this help?


    Eric Legault
    MVP (Outlook)
    About me...
    Friday, January 13, 2012 7:44 PM
    Moderator
  • Thanks Eric yes that definitely helps!     

    For some reason I can't find the RemoveForm or equivalent function? 

    Also how can I get an object to the actual installed form? 

    THANKS!!!

    Friday, January 13, 2012 7:56 PM
  • Is there an equivalent method to MAPIOpenFormMgr/OpenFormContainer using Outlook Object Model.   For some reason I couldn't find one. 

    Friday, January 13, 2012 8:11 PM
  • Yup, there's no capability to remove the published form.  All custom forms exist as items with a Message class of IPM.Microsoft.FolderDesign.FormsDescription.  You'd have to use MAPI or Redemption (recommended) to get a reference to the actual hidden message that represents the published form in the folder (note that forms published to the Personal Forms Library or stored in the top-level folder of the user's default store; with Redemption, use RDOFolder.HiddenItems to get the list of hidden messages).  However, there could be more than one form published in a library, so you'd have to differentiate them via the PR_DISPLAY_NAME property.

    Once you've obtained the item, then you can delete it (with Redemption, using RDOMailItem.Delete).  Note that I'm not 100% sure removing published forms with code is actually supported, but it should work.

    I'm also not sure how to remove or reference custom forms in the Organization Forms Library with code, but there has to be a way.


    Eric Legault
    MVP (Outlook)
    About me...
    • Marked as answer by alexkfh Friday, January 13, 2012 8:23 PM
    Friday, January 13, 2012 8:19 PM
    Moderator
  • Nope; you'd need to use Redemption as I mentioned.
    Eric Legault
    MVP (Outlook)
    About me...
    Friday, January 13, 2012 8:20 PM
    Moderator
  • Thanks Eric this answers my question.    Appreciate the quick responses!  
    Friday, January 13, 2012 8:23 PM
  • One follow up question here.

    We have a form that gets published to the Organization forms library.

    What message class do I use to access the organization forms cache?

    Thanks!

    Alex

    Thursday, November 8, 2012 7:15 PM
  • I'm confused by your question. The forms cache consists of files stored on the user's hard drive.  Forms are published to a forms library using a specific message class.  What exactly do you want to access, how, and why?

    Eric Legault MVP (Outlook)
    About me...
    Try Outlook Appins - affordable and easy to use!

    Thursday, November 8, 2012 10:03 PM
    Moderator
  • In all honesty I'm not too familiar with forms and how they work but I inherited the code and am now responsible for removing obsolete forms programmatically in our code.   If I'm asking the wrong question let me know.   One of our internal users found a problem in our product where the Outlook preview doesn't display the reading pane because of one of our forms that was published to the organizational forms library.   This form is no longer necessary and is an artifact left over from one of our releases a long time ago.  The user reported that after they deleted the form the reading pane displayed properly.  I need to somehow programmatically remove it as I did with the ones that were published in the personal forms library.   Thanks!

    Alex 

    Thursday, November 8, 2012 10:14 PM
  • hold on a second...  maybe I'm looking at the wrong thing.   Let me do some more investigation, something is not adding up. 

    Thursday, November 8, 2012 10:19 PM
  • Eric

    How do I programatically remove the "ShoreWare Conference Form"?   Thanks!


    • Edited by alexkfh Thursday, November 8, 2012 10:31 PM
    Thursday, November 8, 2012 10:30 PM
  • I'm not sure, but I think you need to use ExOLEDB to delete it from the system mailbox - but that's outside the scope of this forum.  You can try asking in the Exchange Developers Forum.

    Otherwise, can you not just delete it from that dialog if you set the Organization Forms library to the right, select the form and click Delete?


    Eric Legault MVP (Outlook)
    About me...
    Try Outlook Appins - affordable and easy to use!

    • Marked as answer by alexkfh Thursday, November 8, 2012 10:46 PM
    Thursday, November 8, 2012 10:42 PM
    Moderator
  • Thanks Eric! 

    We can delete it manually it's just that we don't want our customers to have to do it.   

    Alex

    Thursday, November 8, 2012 10:46 PM