OfficeDev / office-js-docs-reference

Microsoft Office JavaScript API Reference
https://learn.microsoft.com/javascript/api/overview
MIT License
105 stars 63 forks source link

is that possible to set set Signature Default from add-in #1930

Closed junaid042 closed 1 month ago

junaid042 commented 1 month ago

is there any way to set signature as default from add-in using office js like every time when I open new mail this mail already have signature no need to open add-in again or like in this video video link how email signature automatically inserted without opening taskpane

Rick-Kirkham commented 1 month ago

Yes. See this sample: Outlook set signature.

junaid042 commented 1 month ago

I tried this sample yesterday but not working for my in my React/TypeScript Yeoman Generator Add-in. @Rick-Kirkham any sample in React?

junaid042 commented 1 month ago

@Rick-Kirkham simply I want OnMessageCompose get my signature html from localStorage and set is as signature.

Rick-Kirkham commented 1 month ago

@junaid042 The Office.js code is the same regardless of whether you are using React for your UI.

You use the Office.context.roamingSettings.set() method to set a signature as show in the sample file taskpane_main.js.

The file, taskpane_render.js, shows how to read and write from localStorage.

The file, autorunshared.js, shows how to create handlers for events. See the checkSignature method.

The 2 manifests files in the sample, manifest.xml and manifest.json, show how to connect the handler to the new message composed event.

I also recommend that you first read our documentation for event-based add-ins beginning here: Configure your Outlook add-in for event-based activation.

We use the issues in this repo to track problems with the documentation. Programming questions like this one should be raised on Stack Overflow. I'm going to close this now. If you have further questions, please raise them on Stack Overflow.

junaid042 commented 1 month ago

@Rick-Kirkham thanks you very much for your help! on stackoverflow no one giving me answer that's why I asked here. I am trying to finish this and my event is working correctly on web but on Windows desktop when I open new mail this is gives me this error "we can't start this add-in because this is not set up properly" like in this screenshot same and the same thing is working on web outlook any idea? and I have tried to restart my outlook re-installed manifest but it doesn't work.

image

junaid042 commented 1 month ago

@Rick-Kirkham I added <Override type="javascript" resid="runtimeJs"/> in Runtime now not showing this error but still event is not working on desktop outlook

Rick-Kirkham commented 1 month ago

@junaid042 Create a Bug Report on the office-js repo.

junaid042 commented 1 month ago

@Rick-Kirkham I created please check it out issue link