page_type | products | languages | extensions | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sample |
|
|
|
Learn how to check for restricted words in an Outlook email message body, add a recipient to the CC line and check that there is a subject in the email on send.
Note:
- The on send feature is currently supported for Outlook on the web in Office 365 only.
- To learn about the on send feature, see On send feature for Outlook add-ins.
- For a code walkthrough, see Code examples.
- Change history
- Prerequisites
- Configuring and installing the sample
- Upload the manifests
- Run the add-in
- Questions and comments
- Additional resources
April 2017
- Initial version.
- A trusted web server to host the sample files. The server must be able to accept SSL-protected requests (https) and have a valid SSL certificate.
- An Office 365 email account.
- Enable the on send feature - by default, the on send functionality is disabled. Add-ins for Outlook on the web that use the on send feature will run for users who are assigned an Outlook on the web mailbox policy that has the OnSendAddinsEnabled flag set to true. Administrators can enable on send by running Exchange Online PowerShell cmdlets. To learn what cmdlets to run, see Installing Outlook add-ins that use on send
-
Download or fork the repository.
-
Open app.js. In
addCCOnSend
function, change[email protected]
to your own email address. -
Deploy the add-in files to a directory on your web server. The files to upload are app.js and index.html.
-
Open
Contoso Message Body Checker.xml
andContoso Subject and CC Checker.xml
manifest files in a text editor. Replace all instances ofhttps://localhost:3000
with the HTTPS URL of the directory where you uploaded the files in the previous step. Save your changes.For more information about:
- running Outllook add-ins, see Running an Outlook add-in in an Office 365 account
- manifests, see Outlook add-in manifests
- Logon to Outlook Web App.
- Click Settings (the gear cog in the upper right corner of the page) to open the Settings page (as shown in the following screenshot).
- In Your app settings section of the Settings page, choose Mail.
- In the Options page, select General and then Manage add-ins (as shown in the following screenshot).
- On the Manage add-ins page, click the '+' icon, select Add from file. Browse to the
Contoso Message Body Checker.xml
manifest file included in the project. Click Next, then click Install. Finally, click OK. - Repeat step 5 to install
Contoso Subject and CC Checker.xml
manifest file. - Return to the Mail view in Outlook Web App.
- Compose a new Outlook Web App email message.
- Leave the subject line blank.
- Add a recipient in the To line.
- Click Send.
- A carbon copy is added to the CC line. In this sample, it's
[email protected]
. - The email is blocked from being sent and an error message displayed on the information bar to notify sender to add a subject. (as shown in the following screenshot).
- Add a subject line.
- A
[Checked]:
is added to the front of the subject line and email is sent.
- Create a new Outlook Web App email message.
- In the body of the message, type
blockedword
,blockedword1
orblockedword2
. (These are the array of restricted words in the app.js file of thecheckBodyOnlyOnSendCallBack
function). - Add a recipient in the To line.
- Click Send.
- The email is blocked from being sent because of blocked words found in the message body.
- An error message displayed on the information bar to notify sender of blocked words found (as shown in the following screenshot).
- To send the email, remove the blocked words.
We'd love to get your feedback about this sample. You can send your feedback to us in the Issues section of this repository.
Questions about Microsoft Office 365 development in general should be posted to Stack Overflow. If your question is about the Office JavaScript APIs, make sure that your questions are tagged with [office-js] and [API].
- Office add-in documentation
- Office Dev Center
- More Office Add-in samples at OfficeDev on Github
Copyright (c) 2016 Microsoft Corporation. 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 [email protected] with any additional questions or comments.