none
Addin for Outlook2010 and 2013 RRS feed

  • Question

  • I am developing an Outlook addin that is supposed to work in Outlook2010 and 2013.

    I want use some features only available in 2013 SDK.

    It is possible enable some code just if in Outlook2013?

    Thanks & Regards,

    Rui

    Friday, March 21, 2014 4:12 PM

Answers

  • Hello Rui,

    Yes, you can use the late binding technology, see Type.InvokeMember for more information. At runtime you can check the Version property of the Application class and call the new members if they are supported by the current application:


    if (HostMajorVersion > 10)
    {
        object folder = advancedSearch.GetType().InvokeMember("Save", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.Public, null, advancedSearch, new object[] { advancedSearchTag });
     }


    Friday, March 21, 2014 4:24 PM
  • An alternative would be to embed the PIA for Outlook 2013 if the code uses Framework 4 or later.

    In that case test for version before using any methods/properties/events available only for Outlook 2013 and use them only if the runtime version of Outlook shows it's 2013 or later.


    Ken Slovak MVP - Outlook

    Friday, March 21, 2014 5:58 PM
    Moderator

All replies

  • Hello Rui,

    Yes, you can use the late binding technology, see Type.InvokeMember for more information. At runtime you can check the Version property of the Application class and call the new members if they are supported by the current application:


    if (HostMajorVersion > 10)
    {
        object folder = advancedSearch.GetType().InvokeMember("Save", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.Public, null, advancedSearch, new object[] { advancedSearchTag });
     }


    Friday, March 21, 2014 4:24 PM
  • An alternative would be to embed the PIA for Outlook 2013 if the code uses Framework 4 or later.

    In that case test for version before using any methods/properties/events available only for Outlook 2013 and use them only if the runtime version of Outlook shows it's 2013 or later.


    Ken Slovak MVP - Outlook

    Friday, March 21, 2014 5:58 PM
    Moderator