Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

101
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda