OfficeDev / OfficeDev/office-js-docs-reference

why VSTO Outlook Add-in and Office JS add-in conversationId is not same?

Open
#1,856 6 comments 0 reactions 1 assignee View on GitHub

@exextoc is already working on this.

Since Feb 29, 2024.

Needs: attention :wave: Type: product question
Dominant language
TypeScript
Stars
153
Forks
72
Avg merge
2d 23h
Merged PRs (30d)
22

Description

why VSTO Outlook Add-in and Office JS add-in conversationId is not same how can I get same in VSTO like in javascript

but javascript conversationId is different then vsto

using JavaScript mail conversationId = AQQkADAwATNiZmYAZC01OGM3LTFhN2ItMDACLTAwCgAQAEDQN/vy31NNlzWXFRhAMCo=

using vsto mail conversationId = 0776E8C6D9B30D44A4EA16BE9211AA81

using this I am getting conversationId in Office JS add-in

const conversationId = Office.context.mailbox.item.conversationId;

and using this I am getting conversationId in vsto add-in

// Method to get the Conversation ID of the selected email


private string GetSelectedEmailConversationId()
  {
      string conversationId = "";

      try
      {
          Outlook.Application outlookApp = new Outlook.Application();
          Outlook.Explorer explorer = outlookApp.ActiveExplorer();

          // Check if any item is selected
          if (explorer.Selection.Count > 0)
          {
              object selectedItem = explorer.Selection[1];
              if (selectedItem is Outlook.MailItem)
              {
                  Outlook.MailItem mailItem = selectedItem as Outlook.MailItem;
                  // Get the Conversation ID of the selected email
                  conversationId = mailItem.ConversationID;
              }
              else
              {
                  System.Windows.Forms.MessageBox.Show("Please select an email.", "No Email Selected", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
              }
          }
          else
          {
              System.Windows.Forms.MessageBox.Show("Please select an email.", "No Email Selected", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
          }
      }
      catch (Exception ex)
      {
          // Handle any errors
          System.Windows.Forms.MessageBox.Show("An error occurred: " + ex.Message, "Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
      }

      return conversationId;
  }

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.