Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Message Internet headers set in one outlook client are not available in the another client in the draft folder. #2791

Closed
jackdawHome opened this issue Aug 23, 2022 · 3 comments
Labels
Needs: author feedback Waiting for author (creator) of Issue to provide more info Status: no recent activity Issue or PR is stale (no recent activity)

Comments

@jackdawHome
Copy link

Provide required information needed to triage your issue

Your Environment

  • Platform [PC desktop, Mac, iOS, Office on the web]: Windows, Office on the web
  • Host [Excel, Word, PowerPoint, etc.]: Outlook
  • Office version number: Microsoft® Outlook® 2019 MSO (Version 2110 Build 16.0.14527.20234) 32-bit
  • Operating System: Windows 10 Pro version is 21H2, OS build 19044.1469
  • Browser (if using Office on the web): Chrome

Expected behavior

Message saved as a draft with some custom internet headers in one Outlook client (for example Outlook on the web). I should be able to open the same draft in another Outlook client (for example Windows Outlook) and see the same custom headers.

Current behavior

Message saved as a draft with some custom internet headers in the Outlook on the web. Then I open the draft message in the Windows desktop Outlook the headers are lost. The same happens if I save a draft in the Windows desktop Outlook and try to open it in the Outlook on the web.
If I use the same Outlook client to create and then open a draft message I can access my custom headers.

Steps to reproduce

  1. Compose a message in the Outlook desktop, use add-in to set up some internet headers.
  2. Save message as a draft
  3. Open the draft message in the outlook on the web, use add-in to read the custom internet headers.
  4. internetHeaders.getAsync does not return any values.

Link to live example(s)

taskpane.html

<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. -->
<!-- This file shows how to design a first-run page that provides a welcome screen to the user about the features of the add-in. -->

<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Contoso Task Pane Add-in</title>

    <!-- Office JavaScript API -->
    <script type="text/javascript" src="https://appsforoffice.microsoft.com/lib/1.1/hosted/office.js"></script>

    <!-- For more information on Fluent UI, visit https://developer.microsoft.com/fluentui#/. -->
    <link rel="stylesheet" href="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-core/9.6.1/css/fabric.min.css"/>

    <!-- Template styles -->
    <link href="taskpane.css" rel="stylesheet" type="text/css" />
</head>

<body class="ms-font-m ms-welcome ms-Fabric">
    <header class="ms-welcome__header ms-bgColor-neutralLighter">
        <img width="90" height="90" src="../../assets/logo-filled.png" alt="Contoso" title="Contoso" />
        <h1 class="ms-font-su">Welcome</h1>
    </header>
    <section id="sideload-msg" class="ms-welcome__main">
        <h2 class="ms-font-xl">Please sideload your add-in to see app body.</h2>
    </section>
    <main id="app-body" class="ms-welcome__main" style="display: none;">
        <h2 class="ms-font-xl"> Discover what Office Add-ins can do for you today! </h2>
        <ul class="ms-List ms-welcome__features">
            <li class="ms-ListItem">
                <i class="ms-Icon ms-Icon--Ribbon ms-font-xl"></i>
                <span class="ms-font-m">Achieve more with Office integration</span>
            </li>
            <li class="ms-ListItem">
                <i class="ms-Icon ms-Icon--Unlock ms-font-xl"></i>
                <span class="ms-font-m">Unlock features and functionality</span>
            </li>
            <li class="ms-ListItem">
                <i class="ms-Icon ms-Icon--Design ms-font-xl"></i>
                <span class="ms-font-m">Create and visualize like a pro</span>
            </li>
        </ul>
        <div role="button" id="run1" class="ms-welcome__action ms-Button ms-Button--hero ms-font-xl">
            <span class="ms-Button-label">Add headers</span>
        </div>
        <div role="button" id="run2" class="ms-welcome__action ms-Button ms-Button--hero ms-font-xl">
            <span class="ms-Button-label">Remove some headers</span>
        </div>
        <div role="button" id="run3" class="ms-welcome__action ms-Button ms-Button--hero ms-font-xl">
            <span class="ms-Button-label">Read the custom headers</span>
        </div>
        <div id="myDiv"></div>
        <div id="myDiv1"></div>
    </main>
</body>

</html>

taskpane.ts

/*
 * Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
 * See LICENSE in the project root for license information.
 */

/* global document, Office */

Office.onReady((info) => {
  if (info.host === Office.HostType.Outlook) {
    document.getElementById("sideload-msg").style.display = "none";
    document.getElementById("app-body").style.display = "flex";
    document.getElementById("run1").onclick = run;
    document.getElementById("run2").onclick = run2;
    document.getElementById("run3").onclick = run3;
  }
});

export async function run() {
  setCustomHeaders();
}

export async function run2() {
  removeSelectedCustomHeaders();
  document.getElementById("myDiv").innerText = "Done!";
}

export async function run3() {
  getSelectedCustomHeaders();
}
function setCustomHeaders() {
  Office.context.mailbox.item.internetHeaders.setAsync(
    { "x-preferred-fruit": "orange", "x-preferred-vegetable": "broccoli", "x-best-vegetable": "spinach" },
    setCallback
  );
}
function setCallback(asyncResult) {
  if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
    console.log("Successfully set headers");
    getSelectedCustomHeaders();
  } else {
    console.log("Error setting headers: " + JSON.stringify(asyncResult.error));
  }
}
// Get custom internet headers.
function getSelectedCustomHeaders() {
  Office.context.mailbox.item.internetHeaders.getAsync(
    ["x-preferred-fruit", "x-preferred-vegetable", "x-best-vegetable", "x-nonexistent-header"],
    getCallback
  );
}
function getCallback(asyncResult) {
  if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
    console.log("Selected headers: " + JSON.stringify(asyncResult.value));
  } else {
    console.log("Error getting selected headers: " + JSON.stringify(asyncResult.error));
  }
}
// Remove custom internet headers.
function removeSelectedCustomHeaders() {
  Office.context.mailbox.item.internetHeaders.removeAsync(
    ["x-best-vegetable", "x-nonexistent-header"],
    removeCallback);
}
function removeCallback(asyncResult) {
  if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
    console.log("Successfully removed selected headers");
    //getSelectedCustomHeadersRemove();
    getSelectedCustomHeaders();
  } else {
    console.log("Error removing selected headers: " + JSON.stringify(asyncResult.error));
  }
}

Provide additional details

Looks like the different Outlook clients use the different properties to set/get custom Internet headers.

Context

Useful logs

Add-in console log in the Outlook on the web:
Draft created in the Windows desktop Outlook:
Selected headers: {}
Draft created in the Outlook on the web:
Selected headers: {"x-preferred-fruit":"orange","x-preferred-vegetable":"broccoli","x-best-vegetable":"spinach"}

Thank you for taking the time to report an issue. Our triage team will respond to you in less than 72 hours. Normally, response time is <10 hours Monday through Friday. We do not triage on weekends.

@ghost ghost added the Needs: triage 🔍 New issue, needs PM on rotation to triage ASAP label Aug 23, 2022
@exextoc
Copy link
Collaborator

exextoc commented Aug 29, 2022

In Win32, all internet headers are saved to a MAPI prop while composing / in draft mode. They are converted to actual internet headers when sending the email.

OWA doesn't care about the Win32 MAPI prop since they handle internet headers differently.

If you do believe The consistency of internet header is important, you can always submit a feature request on our Tech Community Page with the appropriate label(s).

@exextoc exextoc added Needs: author feedback Waiting for author (creator) of Issue to provide more info and removed Needs: triage 🔍 New issue, needs PM on rotation to triage ASAP labels Aug 31, 2022
@ghost ghost added the Status: no recent activity Issue or PR is stale (no recent activity) label Sep 4, 2022
@ghost
Copy link

ghost commented Sep 4, 2022

This issue has been automatically marked as stale because it is marked as needing author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. Thank you for your interest in Office Add-ins!

@ghost
Copy link

ghost commented Sep 7, 2022

This issue has been closed due to inactivity. Please comment if you still need assistance and we'll re-open the issue.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: author feedback Waiting for author (creator) of Issue to provide more info Status: no recent activity Issue or PR is stale (no recent activity)
Projects
None yet
Development

No branches or pull requests

2 participants