none
MAPIFolderEvents_12_BeforeItemMoveEventHandler not working with Pugin 2010 RRS feed

  • Question

  • Hi,

    We are using outlookplugin2010 here we have registered 'MAPIFolderEvents_12_BeforeItemMoveEventHandler'

    but it is not triggered in shared calender.

    We observer that when appointment save  from Formregion  it is not working for   'BeforeItemMoveEventHandler'

    but when we create normal appointment then it is working.

    When this 2010plugin installed on outlook 2007 it always works.

    kindly help to resolve this issue.

    Regards

    Neeraj


    Neeraj

    Thursday, September 11, 2014 10:44 AM

All replies

  • Hello Neeraj,

    Do you have the latest updates installed for Outlook 2010? It seems you need to install a hotfix. See Description of the Outlook 2010 hotfix package (outlook-x-none.msp): December 14, 2010 for more information.

    You can find the BeforeItemMove doesn't fire in a shared calendar Outlook 2010 SP1 forum thread helpful.

    Thursday, September 11, 2014 12:01 PM
  • Hi

    I have tried as suggested. but still issue exits.

    Event get triggered if we create simple outlook appointment without clicking  Ribbon to loading Formregion with custom app  . If we load our custom plugin by clicking Ribbon and make appointment in outlook from FormRegion (custom plugin app) it is not triggering event.

    kindly help to resolve this issue.

    Regards

    Neeraj


    Neeraj

    Thursday, September 11, 2014 1:17 PM
  • Are you able to reproduce the issue without any other add-ins or button? Just try to handle the BeforeItemMove event. Is it fired?

    It looks like the issue depends on your code.

    Thursday, September 11, 2014 2:00 PM
  • Hi

    a. I have observer that when i have created simple recurring appointment on shared calender  without any add-in then try to delete it  by clicking Delete-> Delete series  then it fire BeforeItemMove event.

    b .But if i have created simple recurring appointment on shared calender   without any add-in then close outlook and  then try to delete it  by clicking Delete-> Delete series  then it did not fire BeforeItemMove event.

    a & b scenario work fine in my default folder (not shared calender )

    Working sample Code is below:

    public partial class ThisAddIn
        {
            private List<string> _folderPaths = new List<string>();
            private List<Items> _calendarItems = new List<Items>();
            private List<MAPIFolderEvents_12_Event> _MAPI12Events = new List<MAPIFolderEvents_12_Event>();
            public static bool _isRescheduleProgress = false;
            Explorer exp = null;
            private void ThisAddIn_Startup(object sender, System.EventArgs e)
            {

                Outlook.MAPIFolder defaultFolder = this.Application.Session.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderCalendar);
                Items items = defaultFolder.Items;

                _calendarItems.Add(items);
                //newCalendarFolder = defaultFolder;
                MAPIFolderEvents_12_Event mapi12Event = (MAPIFolderEvents_12_Event)defaultFolder;
                
                _MAPI12Events.Add(mapi12Event);
                items.ItemChange += new ItemsEvents_ItemChangeEventHandler(Items_ItemChange);
                items.ItemAdd += new ItemsEvents_ItemAddEventHandler(items_ItemAdd);
                exp = this.Application.ActiveExplorer();
                this.Application.ActiveExplorer().BeforeFolderSwitch += new ExplorerEvents_10_BeforeFolderSwitchEventHandler(ThisAddIn_BeforeFolderSwitch);
                mapi12Event.BeforeItemMove += new MAPIFolderEvents_12_BeforeItemMoveEventHandler(Calendar_BeforeItemMove2);
                
            }

            private void ThisAddIn_BeforeFolderSwitch(object NewFolder, ref bool Cancel)
            {
                Outlook.MAPIFolder defaultFolder = NewFolder as MAPIFolder;
                Items items = defaultFolder.Items;
                exp = this.Application.ActiveExplorer();
                _calendarItems.Add(items);
                //newCalendarFolder = defaultFolder;
                MAPIFolderEvents_12_Event mapi12Event = (MAPIFolderEvents_12_Event)defaultFolder;
                //_MAPI12Events.Add(mapi12Event);
                items.ItemChange += new ItemsEvents_ItemChangeEventHandler(Items_ItemChange);
                items.ItemAdd += new ItemsEvents_ItemAddEventHandler(items_ItemAdd);
                mapi12Event.BeforeItemMove += new MAPIFolderEvents_12_BeforeItemMoveEventHandler(Calendar_BeforeItemMove2);
                
            }
            private void Calendar_BeforeItemMove2(object anItem, MAPIFolder aMoveToFolder,
               ref bool Cancel)
            {
                

            }         
            void items_ItemAdd(object Item)
            {


                
            }


            void Items_ItemChange(object Item)
            {
                
            }

            private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
            {
            }

            /// <summary>
            /// To release object
            /// </summary>
            /// <param name="obj">Object</param>
            public static void ReleaseObject(Object obj)
            {
                try
                {
                    int i = 1;
                    do
                    {
                        i = System.Runtime.InteropServices.Marshal.ReleaseComObject(obj);
                    }
                    while (i > 0);
                }
                catch
                { }
                finally
                {
                    obj = null;
                }
            }


            #region VSTO generated code

            /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>
            private void InternalStartup()
            {
                this.Startup += new System.EventHandler(ThisAddIn_Startup);
                this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
            }

            #endregion
        }

    Regards

    Neeraj


    Neeraj

    Thursday, September 11, 2014 2:25 PM
  • Unfortunately that's an open bug that most likely will not be fixed. It was re-opened by a customer for a hot fix recently, but as far as I know there isn't enough of a business case to invest in fixing it so far.

    If you open a support case and reference the bug mentioned below, and make a business case for fixing it, maybe that will help. I've added my voice to requesting it be fixed, but more would be needed and helpful.

    The word I got was : "The issue with BeforeItemMove not firing in shared calendars has been submitted before as Office14 899230.  It was won’t fixed because this is an area of code that is highly subject to regressions and unforeseen issues. "


    Ken Slovak MVP - Outlook

    Thursday, September 11, 2014 2:29 PM
    Moderator
  • It's a bug.

    Ken Slovak MVP - Outlook

    Thursday, September 11, 2014 2:29 PM
    Moderator
  • Hi All,

    @Ken, thanks for your help on this thread.

    @Neeraj,

    I'm trying to involve some senior engineers into this issue and it will take some time. Your patience will be greatly appreciated.

    Sorry for any inconvenience and have a nice day!

    Best regards

    Fei 


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, September 19, 2014 7:43 AM
    Moderator
  • Hi Neeraj,

    I have followed up with Product Group and Supportability Program Manager as well regarding the issue.

    Unfortunately, got the same response that this issue will not be fixed because this is an area of code that is highly subject to regressions and unforeseen issues as Ken mentioned earlier as well.

    Regards,

    Brijs

    Friday, October 31, 2014 10:02 PM