Outlook, setSignatureAsync method adds a new signature but does not replace the existing one #5483
Labels
Area: Outlook
Issue related to Outlook add-ins
Needs: author feedback
Waiting for author (creator) of Issue to provide more info
Similar-Issue
Status: no recent activity
Issue or PR is stale (no recent activity)
Provide required information needed to triage your issue
In an Outlook add-in for Compose mode, we use the setSignatureAsync method to add a new signature, or replace the existing one. In practice, it adds a new signature to an email draft without removing the existing one, if the draft already contains a signature created with the same method but in another Outlook platform, e.g. Outlook Online.
Your Environment
Expected behavior
According to documentation, the setSignatureAsync method shall replace an existing signature.
https://learn.microsoft.com/en-us/javascript/api/outlook/office.body?view=outlook-js-preview#outlook-office-body-setsignatureasync-member(1)
Current behavior
The setSignatureAsync method adds signatures, but not replaces the existing one.
Steps to reproduce
Open Outlook Online, create a new email, open the add-in pane and execute the following code:
Office.context.mailbox.item.body.setSignatureAsync("<div>My signature " + (new Date().toString()) + "</div>", { coercionType: Office.CoercionType.Html }, () => { });
Make sure the draft with the signature is saved, and then close the draft.
Start classic Outlook, open that draft email, open the add-in pane and execute the code above. As you can see, now you have 2 signatures. Save draft, close it.
Start the new Outlook, execute the code above for the same draft. Now you have 3 signatures, please see my screenshot below.
Provide additional details
Useful logs
The text was updated successfully, but these errors were encountered: