0

I developing addin for outlook and i using officejs framework and Yeoman Generator. I use SmartAlerts because with ItemSend event i can't deploy my plugin into Appsource. I have a problem: i would like to call/import my modules from typescript files into launchevent.js, a file to use for event "OnMessageSend". I see on documentation that is not possible.

I tried to create a new bundle but it work only if into file there is a import istruction and in this file i can't use it. How can i do?

Thanks

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45
Morris
  • 3
  • 1
  • Why do you need to mix JS and TS in the same add-in? You can declare your handlers in a .ts file as well where you could import another modules. – Eugene Astafiev Nov 26 '22 at 22:10
  • Can you provide a link to the documentation that is in error? I'll get it fixed. – Rick Kirkham Nov 28 '22 at 18:57
  • The link is: https://learn.microsoft.com/en-us/office/dev/add-ins/outlook/autolaunch?tabs=xmlmanifest#event-based-activation-behavior-and-limitations . The section is after the javasript example code: " Important: Windows: At present, imports aren't supported in the JavaScript file where you implement the handling for event-based activation." . I would like an example with imports. Thanks – Morris Nov 30 '22 at 06:21
  • OK. Now that I understand your issue better, it is not really a problem with the documentation. What that "Important" note says is true. – Rick Kirkham Jan 06 '23 at 23:55

1 Answers1

1

You may create a new add-in skeleton in TypeScript where you can import the required modules to the event handler's module. The TS compiler will produce the required JS files in the output folder. Webpack links code chunks with web pages. But that is not great idea to mix JS and TS files in the same solution. Use one or another programming language for your solutions. I prefer using TypeScript.

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45
  • I thought that, as the documentation says, I could only use a JavaScript file. In fact, this way there are no problems! Perhaps the problem is another: sending the email only crashes after making a call to the server for a login! I'm going to investigate. Thanks – Morris Nov 27 '22 at 08:33
  • The TS file is not executed anyway. The JS file is generated before execution (when the solution is built). – Eugene Astafiev Nov 27 '22 at 10:22