OfficeDev/Outlook-Add-in-JavaScript-GetAttachments

Name: Outlook-Add-in-JavaScript-GetAttachments

Owner: Office Developer

Description: This sample shows you how to get attachments from an Exchange mailbox.

Created: 2015-08-11 20:48:02.0

Updated: 2018-04-05 14:35:46.0

Pushed: 2018-01-31 20:29:05.0

Homepage:

Size: 1370

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Outlook add-in: Get attachments from an Exchange server

Table of contents

Summary

This sample shows you how to get attachments from an Exchange mailbox.

Prerequisites

This sample requires the following:

Key components of the sample

The sample solution contains the following files:

The AttachmentService project defines a REST service by using the WCF API. The project contains the following files:

Description of the code

This sample shows you how to retrieve attachments from a web service that supports your mail add-in. For example, you can create a service that uploads photos to a sharing site, or a service that stores documents into a repository. The service gets the attachments directly from the Exchange server, and doesn't require the client to perform extra processing to get the attachment and then send it along to the service.

The sample has two parts. The first part, the mail app, runs in the email client. The mail add-in is shown whenever a message or an appointment is the active item. When you select the Test attachments button, the mail add-in sends details about the attachment to the web service that processes the request. The service uses the following steps to process attachments:

Build and debug

Note: The mail add-in will be activated on any email message in the user's Inbox that has one or more attachments. You can make it easier to test the add-in by sending one or more email messages to your test account before you run the sample add-in.

  1. Open the solution in Visual Studio.
  2. Right-click the solution in Solution Explorer. Select Set Startup Projects.
  3. Select Common Properties, and choose Startup Project.
  4. Make sure that the Action for AttachmentExampleService project is set to Start.
  5. Press F5 to build and deploy the sample add-in.
  6. Connect to an Exchange account by providing the email address and password for an Exchange 2013 server.
  7. Allow the server to configure the mail account.
  8. Log on to the email account by entering the account name and password.
  9. Select a message in the Inbox.
  10. Wait for the add-in bar to appear over the message.
  11. In the add-in bar, click AttachmentExample.
  12. When the mail add-in appears, click the TestAttachments button to send a request to the Exchange server.
  13. The server will respond with the number of attachments processed for the item. This should equal the number of attachments that the item contains.

Troubleshooting

The following are common errors that can occur when you use Outlook Web App to test a mail add-in for Outlook:

Questions and comments

Additional resources
Copyright

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.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.