SDGroup's avatar
SDGroup
Copper Contributor
Jul 27, 2026
Status:
New

Add Office.js API to set cursor/selection or preserve scroll in Outlook compose

Problem

In new Outlook on Windows and Outlook on the web, a compose add-in cannot insert or replace a reply template at the TOP of the body without the view/cursor jumping to the bottom, and cannot auto-replace previously inserted text while keeping the quoted history visible.

Root cause: there is no Office.js API to set the cursor/caret/selection position in the compose body. body.setAsync/prependAsync deterministically move the cursor to the end of the body (documented; issue #3290, closed with docs only), and setSelectedDataAsync can only replace a selection the USER already made — there is no way to select programmatically. A Microsoft maintainer confirmed in #5188 (May 2025) that cursor positioning is not currently possible and recommended filing here.

Request

Please add ONE of the following to the Mailbox requirement set:

  1. An API to set the caret/selection position in the compose body (e.g. body.setCursorPositionAsync / body.setSelectionAsync), and/or
  2. An option on body.setAsync/prependAsync to PRESERVE the current scroll and cursor position (e.g. { preserveCursor: true }).

Why it matters 

This blocks a very common scenario: reply-template / canned-response / snippet add-ins (e.g. HubSpot Sales in #3290) that need to insert or swap text at the top of a reply while keeping the quoted thread visible and the view stable. Today all three cannot be achieved at once in new Outlook / OWA.

References 

  • github.com/OfficeDev/office-js/issues/3290
  • github.com/OfficeDev/office-js-docs-pr/issues/5188
  • Mailbox requirement sets 1.14–1.16 add no cursor/selection/scroll control.
No CommentsBe the first to comment