none
Outlook 2007 - FormRegion Help? RRS feed

  • Question

  • Hi All

    I am having some problems getting my Outlook 2007 Addin + FormRegion working. I have created the Addin and I have created a new FormRegion which I want to load on the Contact Item from.

    I have created the following startup class:

        [ComVisible(true),
        Guid("88F7BFBE-7666-4a0c-BCFD-2740E6625E04"),
        ProgId("ContactFormHook"),
        ClassInterface(ClassInterfaceType.AutoDual)]
        public class ContactFormHook : Outlook.FormRegionStartup
        {
            public void BeforeFormRegionShow(Outlook.FormRegion FormRegion)
            {
                throw new NotImplementedException();
            }
    
            public dynamic GetFormRegionIcon(string FormRegionName, int LCID, Outlook.OlFormRegionIcon Icon)
            {
                throw new NotImplementedException();
            }
    
            public dynamic GetFormRegionManifest(string FormRegionName, int LCID)
            {
                throw new NotImplementedException();
            }
    
            public dynamic GetFormRegionStorage(string FormRegionName, object Item, int LCID, Outlook.OlFormRegionMode FormRegionMode, Outlook.OlFormRegionSize FormRegionSize)
            {
                throw new NotImplementedException();
            }
        }

    I am unsure how to implement these 4 methods. All the examples I can fund talk about loading an .OFS file from Resources. I do not have a .ofs file, I have created the form region directly within VS 2010, which exists as the following files:

    • ContactForm
    • - ContactForm.Designer.cs
    • - ContactForm.resx

    Can somebody help how I should implement these 4 methods based on the fact that I do not have a .ofs file?

    Thanks


    Monday, April 28, 2014 2:42 PM

Answers

All replies

  • Hello,

    You can find these four methods described in the Walkthrough: Creating an Outlook Form Region article. In that case you need to have a form region designed in Outlook. VSTO provides their own implementation which doesn't require an .ofs - How to: Add a Form Region to an Outlook Add-in Project .


    You can read more about Outlook form regions and various ways of creating them in the Creating Outlook Form Regions section in MSDN.
    Monday, April 28, 2014 2:59 PM
  • Apologies for the late reply.

    I already have this link which doesn't help me. My issue is that I can't find an example of how to do this without having to import an .ofs file file.

    What I want to do is load a custom Contact Form Region when a Contact Item is opened. Maybe someone can let me know how I can export the existing "Out of the Box" Contact Form from Outlook 2007 as a .ofs?

    Maybe I can then customize this?

    Thanks

    Tuesday, May 6, 2014 3:37 PM
  • Hello,

    Open your add-in project in Visual Studio and then right click on the project, choose the Add New Item menu. Then in the just shown wizard choose Outlook/Office in the tree on the left hand side. On the right hand side you need to choose the Form Region template. The in the wizard you need to select the following options:

    Voila!

    Tuesday, May 6, 2014 4:36 PM
  • I have already done this, but the Form Region doesn't seem to load.

    The important thing to note, is that I need to hook into this Form so I can disable/enable fields on the new Contact Form.


    Wednesday, May 7, 2014 8:30 AM
  • Is your add-in loaded by Outlook? Did you have a chance to look at the COM add-ins list?
    Wednesday, May 7, 2014 9:12 AM
  • Yes it is in the Add-in list but doesn't seem to load.
    Wednesday, May 7, 2014 7:34 PM
  • Good news! We have found the cause why you don't see your region in Outlook. Did you have a chance to check the Trust center settings in Outlook?

    Microsoft Office applications can disable add-ins that behave unexpectedly. If an application does not load your add-in the application might have hard disabled or soft disabled your add-in.

    Hard disabling can occur when an add-in causes the application to close unexpectedly. It might also occur on your development computer if you stop the debugger while the Startup event handler in your add-in is executing.

    Soft disabling can occur when an add-in produces an error that does not cause the application to unexpectedly close. For example, an application might soft disable an add-in if it throws an unhandled exception while the Startup event handler is executing.

    When you re-enable a soft-disabled add-in, the application immediately attempts to load the add-in. If the problem that initially caused the application to soft disable the add-in has not been fixed, the application will soft disable the add-in again.

    You can read more about this in the How to: Re-enable an Add-in That Has Been Disabled article in MSDN.

    Is your add-in listed in the Disabled Items list in Outlook?

    Wednesday, May 7, 2014 7:51 PM
  • Hi

    It is not being caused by this. I have debugged the Add-In and in-particular the loading of the Form Region when I open a Contact Item. 

    The issue is that the following method has not been implemented:

    public dynamic GetFormRegionManifest(string FormRegionName, int LCID)
    {
                throw new NotImplementedException();
    }

    Hence this is the reason for my original question, how to I implement the 4 methods whereby I have not imported an existing .ofs but rather created a new Form Region directly within Visual Studio 2010?

    Thanks

    Thursday, May 8, 2014 8:09 AM
  • It's ok I've just reverted to importing a .ofs file.

    Thanks 

    • Marked as answer by KRaheloo Thursday, May 8, 2014 9:25 AM
    Thursday, May 8, 2014 9:24 AM