简体   繁体   中英

How to add a new html page to my react outlook add-in

I created a new outlook add-in using the react-taskpane option in the yeoman generator. I need to insert a new html page to prompt it when there's no signed user is present.

This is the file structure:

在此处输入图像描述

I didn't change the manifest file. But, I included the following in the webpackconfig.js file:

new HtmlWebpackPlugin({
    filename: "Handler.html",
    template: "./src/AppCommon/Auth/Handler.html",
    chunks: ["Handler"],
  }),

When I run npm run build Handler.html gets included in the dist folder. How can I prompt that page in a separate window? (The logic to check whether the user is logged in or not is not needed).

I used this line for that:

window.location.href = app.hostUrl + "/src/AppCommon/Auth/Handler.html";

And I'm getting this error: Cannot GET /src/AppCommon/Auth/Handler.html

How can I define the path correctly?? Thank you in advance

First of all, if you want a separate window, don't use window.location.href. Use the Office.UI.displayDialogAsync method. For more details, see the official documentation: Use the Office dialog API in Office Add-ins

Secondly, I don't think you should have the /src in the URL, especially if you are in production mode and serving the file from /dist .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM