none
Switch Between Outlook 2010 Form Regions Programmatically RRS feed

  • Question

  • Hi,

    i create a Add-In which add a new Form Region to the appointment Item. i created it as a "Seperate" Form Region (not Adjoining or etc). the requirement, well, what i am planning to do is, when the user creating a Appointment Item, he gets the default appointment creation interface, he fills it then click the "Send" button, in that time i capture the send event and i want to switch the view to my custom created From Region. can anyone tell me how to achieve this ? hope u understand the question :)

    thank you!

    Tuesday, February 14, 2012 7:31 AM

Answers

  • i think that name used in SetCurrentFormPage should be full class name for your custom region: fullnamespace.class_name. Please try this.
    • Marked as answer by Mohamed Waseem Tuesday, February 14, 2012 1:45 PM
    Tuesday, February 14, 2012 1:26 PM

All replies

  • Cancel SendItem event (set appropriate event arg) and invoke on inspector SetCurrentFormPage.
    Tuesday, February 14, 2012 8:13 AM
  • Hei DamianD,

    i think Inspector.SetCurrentFormPage is not working.... u suggesting to use tht method inside the Form Region code or inside the ThisAddIn.cs ?

    Tuesday, February 14, 2012 9:11 AM
  • Your form region displays additional Tab in Appointment window, is that correct?
    Tuesday, February 14, 2012 9:26 AM
  • Yes it is....
    Tuesday, February 14, 2012 12:08 PM
  • Is your call to SetCurrentFormPage throwing exception or simply silently does nothing? Paste code for whole function that tries to set your region visible.

    Tuesday, February 14, 2012 12:17 PM
  • i'm not getting any error message..... just nothing happens....

    the Code is

            Outlook.AppointmentItem appointment;
            Outlook.Inspector ins;
     
            privatevoid Test_FormRegionShowing(object sender, System.EventArgs e)
            {
                appointment = this.OutlookItem as Outlook.AppointmentItem;
                ins =Appointment.GetInspector;
                ((Outlook.ItemEvents_10_Event)appointment).Send += new Outlook.ItemEvents_10_SendEventHandler(Test_Send);
            }

    void Test_Send(refbool Cancel)         {

    cancel = true;                        ins.SetCurrentFormPage("testForm");         }

                  


    Note: this code resides inside the Form Region Code File

    Tuesday, February 14, 2012 1:23 PM
  • i think that name used in SetCurrentFormPage should be full class name for your custom region: fullnamespace.class_name. Please try this.
    • Marked as answer by Mohamed Waseem Tuesday, February 14, 2012 1:45 PM
    Tuesday, February 14, 2012 1:26 PM
  • WoW..... You RoX :) its working... thank you sooo much DamianD

    i more Question :)

    at the moment i mean in ma code as u see, the Send item event Binding is done in the "Test_FormRegionShowing" Event, but when the User creating a new Appointment, it wont invoke this event, is there a better place to put this event Binding ???

    Tuesday, February 14, 2012 1:42 PM
  • yes, you should bind to ItemSend event on Application object, and it would be best to do it as quickly as possible, for example in addin startup event.
    • Marked as answer by Mohamed Waseem Tuesday, February 14, 2012 2:01 PM
    • Unmarked as answer by Mohamed Waseem Tuesday, February 14, 2012 2:01 PM
    Tuesday, February 14, 2012 1:55 PM
  • oops! can you give me a quick advice on how to do that pls ?
    Tuesday, February 14, 2012 2:02 PM
  • private void ThisAddin_Startup(object, EventArgs)

    {

    Application.ItemSend += ... your event handler

    }

    there you will get Item that is being sent and possibility to cancel that event - you will need to cast using 'as' checking if this object is your item type. In case of meeting it will be MeetingRequest.

    Tuesday, February 14, 2012 2:05 PM
  • hei Daminan, the thig is my event handler is in Form Region code but not in ThisAddin class... so how can i bind that here ?
    Tuesday, February 14, 2012 2:14 PM
  • use could use appointment.Application.ItemSend - is that enough for you? Of course going this way you will not get any notification untill user actually opens up any existing appointment. Is this is not acceptable for you, upgrade your code to fully fledged add-in project and attach to event in startup function.
    Tuesday, February 14, 2012 2:32 PM
  • Thank you Damina, thank you so much. i'l try upgrading my code. and thank you again...
    Wednesday, February 15, 2012 4:53 AM