none
Outlook Explorer.SelectionChange Event fires inside Outlook Addin(inside CustomTaskPane) RRS feed

  • Question

  • Hi,

    I am facing problem related to Explorer.SelectionChange event in Outlook 2010.
    I have created Outlook Addin using VSTO in VS 2010.
    We want Explorer.SelectionChange Event should not fire inside the Outlook Addin creted using CustomTaskPane.

    Case one:

    1.Select outlook item inside the Inbox Folder
      Explorer.SelectionChange Event fires (which is as expected)
    2.click inside the Outlook Addin
      Explorer.SelectionChange Event is not firing (which is as expected)
     
    Case Two:

    1.Select any outlook item inside the Inbox Folder
      Explorer.SelectionChange Event fires (which is as expected)
    2.Select any outlook item inside the To-Do bar
      Explorer.SelectionChange Event fires (which is as expected)
    3.Click inside the Outlook Addin
      This time Explorer.SelectionChange Event is fired (which is not expected)
     
    Case one works perfectly.
    In Case two,
    why Explorer.SelectionChange Event is getting fired after step 2?

    Is there way to disable Explorer.SelectionChange Event inside the Outlook Addin?
    Please advise.


    -- Happiness is only real when shared :)

    Friday, February 10, 2012 8:08 AM

Answers

  • I have no idea why that behavior exists for SelectionChange() related to your CTP. The only thing I can suggest is to use code to handle that special case.

    --
    Ken Slovak
    MVP - Outlook
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
     
     
    "Vipul Arwade" <=?utf-8?B?VmlwdWwgQXJ3YWRl?=> wrote in message news:9b1854e9-a02f-47df-a2b5-92b8b160b38c...

    Hi Ken,

    Click inside the Outlook Addin means

    I have created one Outlook Addin using CustomTaskPane and it contains UI controls.
    Click inside the Outlook Addin means click inside the CustomTaskPane or selelction of any dropdown in CustomtaskPane or writting something in textbox inside the CustomTaskPane.

    Current Outlook Explorer has
    1.Inbox Folder
    2.To-Do bar(contains Date Navigator,Appointments and Task list)
    3.Outlook Addin - Created using VSTO

    To-Do Bar contains multiple items like Appointments,Flaged items(mails,meetings).

    Case 1
    When I select any task (flaged item) in TO-Do Bar and then click\select any control in Addin,Explorer.SelectionChange event is not fired which is expected.

    Case 2

    but when select Appointment in To-Do bar and click\select any control in Addin,Explorer.SelectionChange event is fired which cretes proplem and which is not expected.

    Why Explorer.SelectionChanged event is fired in Case 2?
    Is it because of Focus?
    Or is it a bug?
    Or any kind of functionality?


    -- Happiness is only real when shared :)


    Ken Slovak MVP - Outlook
    Monday, February 13, 2012 2:45 PM

All replies

  • Hi,


    If i understood correctly.You want to ignore the selection functionality for some specific folder.

     If yes, you cannot disable the Explorer.SelectionChange event for the particular folder.

    This Event will be triggered always whenever you select the outlook item, it may be mail,task,contact etc...

    So if you want to ignore the functionality which is written inside the selectionchange event,
    find the parent of the selected item and match with desired folder.

    For example:

    explorer_SelectionChange()
    {
        // if it is a mailitem
        string foldername = ((explorer.Selection[1] as Outlook.MailItem).Parent as Outlook.Folder).Name;

        //compare the desired folder
        if (foldername == "Outlook Addin")
        {
            return; // do nothing
        }

        // do something

    }

    Hopes this helps.


    venugopal

    Friday, February 10, 2012 9:48 AM
  •  

    Hi,

    I dont want to ignore selection change event inside specific folder.

    Case One

    In To-Do Bar(Explorer - Inbox),if I select Meeting\Appointment Item

    and then try to click inside the Outlook Addin Explorer.SelectionChange is  getting fired.

    Case Two

    But if I select any other Item whcih are flaged and then click inside the Outlook Addin Explorer.SelectionChange

    doesn't get fired. 

    I dont know why,Explorer.SelectionChange event is fired when If I click inside the Outlook Addin after ckick on Meeting item inside the To-Do Bar.


    -- Happiness is only real when shared :)

    Friday, February 10, 2012 11:43 AM
  • Define what you mean by "click inside the Outlook Addin". Where specifically are you clicking?

    --
    Ken Slovak
    MVP - Outlook
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
     
     
    "Vipul Arwade" <=?utf-8?B?VmlwdWwgQXJ3YWRl?=> wrote in message news:2f8f8b1a-01d5-43b2-9c11-a27335398b8d...
     

    Hi,

    I dont want to ignore selection change event inside specific folder.

    Case One

    In To-Do Bar(Explorer - Inbox),if I select Meeting\Appointment Item

    and then try to click inside the Outlook Addin Explorer.SelectionChange is  getting fired.

    Case Two

    But if I select any other Item whcih are flaged and then click inside the Outlook Addin Explorer.SelectionChange

    doesn't get fired. 

    I dont know why,Explorer.SelectionChange event is fired when If I click inside the Outlook Addin after ckick on Meeting item inside the To-Do Bar.


    -- Happiness is only real when shared :)


    Ken Slovak MVP - Outlook
    Friday, February 10, 2012 4:36 PM
  • Hi Ken,

    Click inside the Outlook Addin means

    I have created one Outlook Addin using CustomTaskPane and it contains UI controls.
    Click inside the Outlook Addin means click inside the CustomTaskPane or selelction of any dropdown in CustomtaskPane or writting something in textbox inside the CustomTaskPane.

    Current Outlook Explorer has
    1.Inbox Folder
    2.To-Do bar(contains Date Navigator,Appointments and Task list)
    3.Outlook Addin - Created using VSTO

    To-Do Bar contains multiple items like Appointments,Flaged items(mails,meetings).

    Case 1
    When I select any task (flaged item) in TO-Do Bar and then click\select any control in Addin,Explorer.SelectionChange event is not fired which is expected.

    Case 2

    but when select Appointment in To-Do bar and click\select any control in Addin,Explorer.SelectionChange event is fired which cretes proplem and which is not expected.

    Why Explorer.SelectionChanged event is fired in Case 2?
    Is it because of Focus?
    Or is it a bug?
    Or any kind of functionality?


    -- Happiness is only real when shared :)

    Monday, February 13, 2012 4:53 AM
  • I have no idea why that behavior exists for SelectionChange() related to your CTP. The only thing I can suggest is to use code to handle that special case.

    --
    Ken Slovak
    MVP - Outlook
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
     
     
    "Vipul Arwade" <=?utf-8?B?VmlwdWwgQXJ3YWRl?=> wrote in message news:9b1854e9-a02f-47df-a2b5-92b8b160b38c...

    Hi Ken,

    Click inside the Outlook Addin means

    I have created one Outlook Addin using CustomTaskPane and it contains UI controls.
    Click inside the Outlook Addin means click inside the CustomTaskPane or selelction of any dropdown in CustomtaskPane or writting something in textbox inside the CustomTaskPane.

    Current Outlook Explorer has
    1.Inbox Folder
    2.To-Do bar(contains Date Navigator,Appointments and Task list)
    3.Outlook Addin - Created using VSTO

    To-Do Bar contains multiple items like Appointments,Flaged items(mails,meetings).

    Case 1
    When I select any task (flaged item) in TO-Do Bar and then click\select any control in Addin,Explorer.SelectionChange event is not fired which is expected.

    Case 2

    but when select Appointment in To-Do bar and click\select any control in Addin,Explorer.SelectionChange event is fired which cretes proplem and which is not expected.

    Why Explorer.SelectionChanged event is fired in Case 2?
    Is it because of Focus?
    Or is it a bug?
    Or any kind of functionality?


    -- Happiness is only real when shared :)


    Ken Slovak MVP - Outlook
    Monday, February 13, 2012 2:45 PM