GithubHelp home page GithubHelp logo

isabella232 / outlook-add-in-scanforme Goto Github PK

View Code? Open in Web Editor NEW

This project forked from officedev/outlook-add-in-scanforme

0.0 0.0 0.0 2.1 MB

This Outlook add-in checks whether the user is mentioned on the To line, cc line or body of an email.

License: MIT License

CSS 11.05% JavaScript 88.85% HTML 0.08% C# 0.02%

outlook-add-in-scanforme's Introduction

page_type products languages description urlFragment extensions
sample
office
office-outlook
office-365
javascript
How to use the JavaScript API for Office to create an Outlook add-in that parses the body of an email looking for hyperlinks.
outlook-scan-sample
contentType technologies createdDate
samples
Add-ins
8/29/2015 7:47:24 PM

Outlook add-in: A mail add-in for a read scenario that checks whether the user is mentioned on the To line, cc line or body of an email.

Table of contents

##Summary

In this sample we show you how to use the JavaScript API for Office to create an Outlook add-in that parses the body of an email looking for hyperlinks. The following is a picture of the scenario in question.

##Prerequisites This sample requires the following:

  • Visual Studio 2015.
  • A computer running Exchange 2013 with at least one email account, or an Office 365 account. You can sign up for an Office 365 Developer subscription and get an Office 365 account through it.
  • Internet Explorer 9 or later, which must be installed but doesn't have to be the default browser. To support Office Add-ins, the Office client that acts as host uses browser components that are part of Internet Explorer 9 or later.
  • One of the following as the default browser: Edge, Internet Explorer 9, Safari 5.0.6, Firefox 5, Chrome 13, or a later version of one of these browsers.
  • Familiarity with JavaScript programming and web services.

##Key components

This solution was created in Visual Studio. It consists of two projects - ScanForMe and ScanForMeWeb. Here's a list of the key files within those projects.

ScanForMe project

ScanForMeWeb project

  • ItemRead.html The HTML user interface for the Outlook add-in.
  • ItemRead.js The JavaScript code used by Home.html to interact with Word using the JavaScript for Office API.

##Description of the code

The core logic of this sample is in the ItemRead.js file in the ScanForMeWeb project.

Once the add-in is initialized, the item.to and item.cc properties are scanned for the presence of the user's email address. The user email address is retrieved from the Office.context.mailbox.userProfile property. If the user was found on the to or cc lines of this email, that fact is registered on the UI of the add-in.

The getAsync() method of the Body object is then used to retrieve the body of the email in Text format. When this asynchronous operation is completed, our inline callback function is invoked. This function uses a regular expression to scan the text of the email body for occurrences of the user's first name. If one or more occurrences are found, the UI of the add-in notes that the user was mentioned in the body of the email.

Note: For an example of using getAsync to retrieve the body of an email in HTML format, see the Outlook-Add-in-LinkRevealer sample.

##Build and debug

  1. Open the ScanForMe.sln file in Visual Studio.
  2. Press F5 to build and deploy the sample add-in
  3. When Outlook launches, select an email from your inbox
  4. Launch the add-in by selecting it from the add-in app bar

Questions and comments

  • If you have any trouble running this sample, please log an issue.
  • Questions about Office Add-ins development in general should be posted to Stack Overflow. Make sure that your questions or comments are tagged with [office-addins].

Contributing

We encourage you to contribute to our samples. For guidelines on how to proceed, see our contribution guide

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.

Additional resources

Copyright

Copyright (c) 2015 Microsoft. All rights reserved.

outlook-add-in-scanforme's People

Contributors

andrewjbyrne avatar mimisasouvanh avatar mlafleur avatar o365devx avatar officegsx avatar rick-kirkham avatar supernova-eng avatar tadaomachida avatar v-mipop avatar v-pazal avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.