office365-appsoffice-js

how to read the web.config file values in office addins office.js


i am developing an excel add-ins using office.js, i want to keep the different configuration settings in the web.config files, and read those settings in the java-script file. how to do that.

is office add-in sample project is MVC asp.net project, should i be returning the view from there and my source location in manifest point to that view.

please guide me to correct approach.


Solution

  • Generally speaking, this is not something that is Office Add-in specific. You would you would use the same approach as with a regular website. For example, see Reading web.config from JavaScript.

    In terms of the manifest start URL, you can point it at any web-browsable page, it doesn't have to end with .html. So you can use an aspx or MVC view page. Alternatively, you can have an html/js/css page that makes an AJAX web service call to your own web API that returns you the settings. If I may recommend, see my blog post for how to create a web service for an Office Add-in using the ASP.NET Web API.

    Hope this helps!

    ~ Michael Zlatkovsky, developer on Office Extensibility team, MSFT