Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

100
Vistas
Office.EventType.ItemChanged doesn't seem to fire

I am trying to test a simple console.log print test when I move from one email to another in outlook. I am following the instructions from Microsoft here: https://docs.microsoft.com/en-us/office/dev/add-ins/outlook/pinnable-taskpane#handling-ui-updates-based-on-currently-selected-message

My manifest file already supports pinning and I use pinning in all my outlook addin projects.

I followed this code from microsoft yet it doesn't seem to do anything in the developer console:

function itemChanged(eventArgs) {
  // Update UI based on the new current item
  UpdateTaskPaneUI(Office.context.mailbox.item);
}

// Example implementation
function UpdateTaskPaneUI(item)
{
  // Assuming that item is always a read item (instead of a compose item).
  if (item != null) console.log(item.subject);
}

Office.initialize = function (reason) {
  $(document).ready(function () {

    // Set up ItemChanged event
    Office.context.mailbox.addHandlerAsync(Office.EventType.ItemChanged, itemChanged);

    UpdateTaskPaneUI(Office.context.mailbox.item);
  });
};

I was assuming that I was going to receive the subject of which ever email I was highlighted on in outlook but nothing happened. I also double clicked on an email to see if the event was fired only by the email being in its own window and nothing happened still.

I am running Microsoft® Outlook® for Microsoft 365 MSO (Version 2111 Build 16.0.14701.20254) 64-bit

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I was able to get it to work. I was first testing in the dev tool's console so I assumed that would have worked but it was casuing me errors. The moment I tested the code in the javascript for the outlook addin itself it started to work:

Office.onReady((info) => {
  $(document).ready(function () {

    function itemChanged(eventArgs) {
      // Update UI based on the new current item
      UpdateTaskPaneUI(Office.context.mailbox.item);
    }
    
    // Example implementation
    function UpdateTaskPaneUI(item)
    {
      // Assuming that item is always a read item (instead of a compose item).
      if (item != null) console.log(item.subject);
    }
  
        // Set up ItemChanged event
        Office.context.mailbox.addHandlerAsync(Office.EventType.ItemChanged, itemChanged);
    
        UpdateTaskPaneUI(Office.context.mailbox.item);
})
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda