Name: Office-Add-in-JavaScript-WebApiService
Owner: Office Developer
Description: Shows how to create and query an ASP.NET Web API service from an Office Add-in.
Created: 2015-08-12 22:41:04.0
Updated: 2018-04-24 22:52:12.0
Pushed: 2017-12-28 21:31:15.0
Size: 925
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Table of contents
This sample demonstrates how to create and query an ASP.NET Web API service from an Office Add-in. The sample is comprised of a “Send Feedback” page, which lets a user submit feedback, and uses a Web API service to send it to the developer team.
This sample requires the following:
The sample solution contains the following key files:
WebApi Sample project
WebApi SampleWeb project
The Office Add-in makes an AJAX request to the web service, passing in data from the client-side JavaScript code. The Web API controller receives the data, performs an action, and returns the results back to the caller. The AJAX call then completes, displaying the results or showing an error message.
The sample will run right out of the box, but it won't be able to send feedback unless you configure appropriate credentials. To configure the credentials, open SendFeedbackController.cs (in the Controllers folder of the web project) and update the following constants with actual values:
t string MailingAddressFrom = "add-in_name@contoso.com ";
t string MailingAddressTo = "dev_team@contoso.com";
t string SmtpHost = "smtp.contoso.com";
t int SmtpPort = 587;
t bool SmtpEnableSsl = true;
t string SmtpCredentialsUsername = "username";
t string SmtpCredentialsPassword = "password";
Copyright (c) 2015 Microsoft. All rights reserved.
This project has adopted the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.