none
Which appointment event to capture when saving form region data changes RRS feed

  • Question

  • Hi,

    I have an appointment form region where users can ask for support (IT support,Catering support).The form has checkbox lists and comment textboxes for each support type.When end users create new appointments, they fill in the details of the appointment (.e.g subject,location..),and they also fill in support request using the form region.I used to use the AppointmentItem.Write event to save the form region data since this event is fired for saving new appointments.I later knew that if the user open an existing appointment and changes support details (through form region), the AppointmentItem.Write will not fire since the appointment properties (e.g. subject,location,start date) has not been modified.So I switched to using the ItemEvents_10_Event.Close event since it is called for all opened items.Now I started to hate this event as my project logic and validation blocks grow.

    I wanted to go back and use AppointmentItem.Write as a centralized place for saving form region data changes and I know I can trigger this event by modifying one of the appointment properties like:

    appointmentItem.Subject = appointmentItem.Subject;

    The drawback of this technique is that I need to call this code when showing my form region and this will trigger the AppointmentItem.Write event even if there is no change in the support request details.

    Is there a better way ?.

    How to correlate changes in my form region data (through form controls) and the appointment itself so the appointment automatically calls the Write event ?

    Regards,

    Madani

    Thursday, March 29, 2012 12:25 PM

Answers

  • I would try using UserProperties instead of named MAPI fields with PropertyAccessor. I'd also make sure to update the user properties as the controls in the form region change. I think that's the best way to do what you want.

    --
    Ken Slovak
    MVP - Outlook
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
     
     
    "Madani Benghia" <=?utf-8?B?TWFkYW5pIEJlbmdoaWE=?=> wrote in message news:54e512c4-5e7e-4574-8e76-d09ccf724bfe...

    Thanks Slovak. I am using custom properties (PropertyAccessor) and my form region is designed in Visual Studio using Windows Form User Controls.I am also not using custom field binding.

    Thanks

    Madani


    Ken Slovak MVP - Outlook
    Thursday, March 29, 2012 2:55 PM

All replies

  • Do you bind your custom fields in the form region to user properties in the Outlook item? If you do that, maybe updating a user property based on a change or other event in a form region control, that should dirty the appointment and then on Close() you can check for the item's Saved property. That should be false if user properties on the item are changed.

    --
    Ken Slovak
    MVP - Outlook
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
     
     
    "Madani Benghia" <=?utf-8?B?TWFkYW5pIEJlbmdoaWE=?=> wrote in message news:7d207059-0f12-462a-9972-10d2d6f595a1...

    Hi,

    I have an appointment form region where users can ask for support (IT support,Catering support).The form has checkbox lists and comment textboxes for each support type.When end users create new appointments, they fill in the details of the appointment (.e.g subject,location..),and they also fill in support request using the form region.I used to use the AppointmentItem.Write event to save the form region data since this event is fired for saving new appointments.I later knew that if the user open an existing appointment and changes support details (through form region), the AppointmentItem.Write will not fire since the appointment properties (e.g. subject,location,start date) has not been modified.So I switched to using the ItemEvents_10_Event.Close event since it is called for all opened items.Now I started to hate this event as my project logic and validation blocks grow.

    I wanted to go back and use AppointmentItem.Write as a centralized place for saving form region data changes and I know I can trigger this event by modifying one of the appointment properties like:

    appointmentItem.Subject = appointmentItem.Subject;

    The drawback of this technique is that I need to call this code when showing my form region and this will trigger the AppointmentItem.Write event even if there is no change in the support request details.

    Is there a better way ?.

    How to correlate changes in my form region data (through form controls) and the appointment itself so the appointment automatically calls the Write event ?

    Regards,

    Madani


    Ken Slovak MVP - Outlook
    Thursday, March 29, 2012 1:02 PM
  • Thanks Slovak. I am using custom properties (PropertyAccessor) and my form region is designed in Visual Studio using Windows Form User Controls.I am also not using custom field binding.

    Thanks

    Madani

    Thursday, March 29, 2012 1:22 PM
  • I would try using UserProperties instead of named MAPI fields with PropertyAccessor. I'd also make sure to update the user properties as the controls in the form region change. I think that's the best way to do what you want.

    --
    Ken Slovak
    MVP - Outlook
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
     
     
    "Madani Benghia" <=?utf-8?B?TWFkYW5pIEJlbmdoaWE=?=> wrote in message news:54e512c4-5e7e-4574-8e76-d09ccf724bfe...

    Thanks Slovak. I am using custom properties (PropertyAccessor) and my form region is designed in Visual Studio using Windows Form User Controls.I am also not using custom field binding.

    Thanks

    Madani


    Ken Slovak MVP - Outlook
    Thursday, March 29, 2012 2:55 PM