问题
I have a JS Outlook Add-in that I'd like to be able to deploy to multiple sites, but I'd like to deploy the same code to every site and handle configuration data externally, if possible. Something like process.env (that works for a Node.js server App) for a client App. I see it's possible to define Application Settings in Azure, but how can I access the values in the App?
回答1:
If you're able to distribute a different manifest to each customer, you can add a query parameter to any SourceLocation URLs in the manifest to pass information to the add-in on startup.
<bt:Url id="Taskpane.Url" DefaultValue="https://contoso.azurewebsites.net/Taskpane.html?<per-customer query string>" />
回答2:
Thanks Outlook Add-ins Team, that works fine; for the benefit for any other readers, a few details
- Extracting the parameter value in the target JS is made easy by using URLSearchParams()
- This solution concentrates the customer variance in the Manifest, leaving the bulk of the solution in JS that is the same for all deployments, a key objective
- As an aside: the customer variances to the Manifest can be reduced to minimum by using ~remoteAppUrl
来源:https://stackoverflow.com/questions/64965093/is-there-any-way-to-pass-configuration-parameters-to-an-outlook-addin