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

When replying or forwarding an email, calling body.setAsync resets the email body twice #4461

Open
bchen-hs-eng opened this issue May 15, 2024 · 5 comments
Assignees
Labels
Area: Outlook Issue related to Outlook add-ins Needs: attention 👋 Waiting on Microsoft to provide feedback

Comments

@bchen-hs-eng
Copy link

bchen-hs-eng commented May 15, 2024

Provide required information needed to triage your issue

Likely related #4392

Calling body.setAsync on a reply/forward email will cause the email body to reset, interfering with entering text.

Your Environment

  • Platform [PC desktop, Mac, iOS, Office on the web]: PC desktop
  • Host [Excel, Word, PowerPoint, etc.]: Outlook
  • Office version number: 2402 (Build 17328.20282 Click-to-run)
  • Operating System: Windows 11
  • Browser (if using Office on the web): ______

Expected behavior

body.setAsync sets the email body without extra side effects

Current behavior

body.setAsync sets the email body and the email body resets twice. If the user is actively typing into the email body, the contents can be cleared/reset

Steps to reproduce

  • Open a received email and press the reply button. We see this issue on the Microsoft Viva emails.
  • Execute item.body.getAsync, and sets the same content back with item.body.setAsync

Link to live example(s)

Javascript

$("#run").on("click", run);

const timeout = 1000;

function run() {
  // Gets current email body
  Office.context.mailbox.item.body.getAsync(Office.CoercionType.Html, (result) => {
    document.getElementById("firstBody").innerHTML = escapeHtml(result.value);

    setTimeout(() => {
      // Sets the same email body
      Office.context.mailbox.item.body.setAsync(result.value, { coercionType: Office.CoercionType.Html }, (result) => {
        Office.context.mailbox.item.body.getAsync(Office.CoercionType.Html, (result) => {
          // Gets email body again after setAsync
          document.getElementById("secondBody").innerHTML = escapeHtml(result.value);
        });
      });
    }, timeout);
  });
}

function escapeHtml(html) {
  return html
    .replace(/&/g, "&")
    .replace(/</g, "&lt;")
    .replace(/>/g, "&gt;")
    .replace(/"/g, "&quot;")
    .replace(/'/g, "&#039;");
}

HTML

<div>
	<button id="run" class="ms-Button">
    <span class="ms-Button-label">Run</span>
</button>

	<p>--FIRST--</p>
	<p id="firstBody"></p>
	<br><br>
	<p>--SECOND--</p>
	<p id="secondBody"></p>
</div>

Context

  • The flicker severely interfere with a user trying to type into the reply/forward email body.
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: triage 🔍 New issue, needs PM on rotation to triage ASAP label May 15, 2024
@exextoc exextoc added Needs: attention 👋 Waiting on Microsoft to provide feedback Area: Outlook Issue related to Outlook add-ins and removed Needs: triage 🔍 New issue, needs PM on rotation to triage ASAP labels May 15, 2024
@exextoc exextoc self-assigned this May 15, 2024
@hsptkt
Copy link

hsptkt commented May 15, 2024

Hi @exextoc, this is actively affecting our customers using Outlook for Windows, and they're reporting disruption to their workflows. Please let us know if the team is able to revert this change to mitigate user pain. Thank you

@bchen-hs-eng bchen-hs-eng changed the title When replying or forwarding an email, calling body.setAsync causes the email body to flicker twice When replying or forwarding an email, calling body.setAsync resets the email body twice May 16, 2024
@akshayta23
Copy link
Collaborator

@Oleg-O Is this something your team can help with?

@zhngx1
Copy link

zhngx1 commented May 20, 2024

@hsptkt @akshayta23 I cannot repro the issue. Do you repro it only when call body.setAsync after the body.getAsync? Can you repro with directly calling body.setAsync?

@bchen-hs-eng
Copy link
Author

@zhngx1 We can repro this using Script Lab, and the javascript/html pair in the issue description consistently. It calls body.setAsync after the body.getAsync, which emulates our real production add-in's usages.

@bchen-hs-eng
Copy link
Author

bchen-hs-eng commented May 31, 2024

@zhngx1 Any updates on this issue? Here is a recording demonstrating this issue through the provided script lab snippets:

getsetbody_flicker.mov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Outlook Issue related to Outlook add-ins Needs: attention 👋 Waiting on Microsoft to provide feedback
Projects
None yet
Development

No branches or pull requests

5 participants