# outlook

> A package for calling the Outlook APIs from Node.

Latest version **1.1.4** (published 2016-01-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install outlook
pnpm add outlook
yarn add outlook
bun add outlook
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.4 |
| Published | 2016-01-05 |
| First published | 2016-01-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 (+3 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Jason Johnston |
| Maintainers | bluerival |
| Keywords | office365, outlook, mail, calendar, contacts |

## Links

- npm: https://www.npmjs.com/package/outlook
- Repository: https://github.com/bluerival/node-outlook
- Issues: https://github.com/bluerival/node-outlook/issues
- npm.io page: https://npm.io/package/outlook

## Dependencies (3)

- [request](https://npm.io/package/request.md) 2.58.0
- [node-uuid](https://npm.io/package/node-uuid.md) 1.4.3
- [xmlhttprequest](https://npm.io/package/xmlhttprequest.md) 1.7.0

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 1.1.4 (latest) — 2016-01-05
- 1.1.3 — 2016-01-05

## README

# Node.js Wrapper for Office 365 APIs Client Library #

This library provides a light-weight implementation of the Outlook [Mail](https://msdn.microsoft.com/office/office365/APi/mail-rest-operations), [Calendar](https://msdn.microsoft.com/office/office365/APi/calendar-rest-operations), and [Contacts](https://msdn.microsoft.com/office/office365/APi/contacts-rest-operations) APIs. 

For a sample app that uses this library, see [Getting Started with the Outlook Mail API and Node.js](https://github.com/jasonjoh/node-tutorial).

> The original version of this library was a simple wrapper intended to enable use of the [Microsoft Office 365 APIs Client Libraries for Cordova Applications](https://www.nuget.org/packages/Microsoft.Office365.ClientLib.JS/) from a Node.js app. This version still includes the old interfaces, but no further development is being made on that part of this library. It is recommended that applications use the new interfaces moving forward.

## Required software ##

- [Microsoft Office 365 APIs Client Libraries for Cordova Applications](https://www.nuget.org/packages/Microsoft.Office365.ClientLib.JS/) (Included)
- [node-XMLHttpRequest](https://github.com/driverdan/node-XMLHttpRequest)

## Installation ##

Installing should be done via NPM:

    npm install node-outlook

## Usage ##

Once installed, add the following to your source file:

    var outlook = require("node-outlook");

### New interface ###

#### Configuration ####

Configuration of the library is done via the `base` namespace:

- `outlook.base.setApiEndpoint` - Use this to override the API endpoint. The default value uses the Outlook v1.0 enpoint: `https://outlook.office.com/api/v1.0`.
- `outlook.base.setAnchorMailbox` - Set this to the user's SMTP address to enable the API endpoint to efficiently route API requests.
- `outlook.base.setPreferredTimeZone` - Use this to specify a time zone for the server to use to return date/time values in the Calendar API.

#### Making API calls ####

The library has a namespace for each API.

- `outlook.mail` - The Mail API
- `outlook.calendar` - The Calendar API
- `outlook.contacts` - The Contacts API

Each namespace has minimal functions (more to come). Usage is similar between the namespaces. For example, this is how you call the `getMessages` function in the `outlook.mail` namespace:

    // Specify an OData query parameters to include in the request
    var queryParams = {
      '$select': 'Subject,ReceivedDateTime,From',
      '$orderby': 'ReceivedDateTime desc',
      '$top': 10
    };
    
    // Set the API endpoint to use the v2.0 endpoint
    outlook.base.setApiEndpoint('https://outlook.office.com/api/v2.0');
    // Set the anchor mailbox to the user's SMTP address
    outlook.base.setAnchorMailbox(email);
    
    outlook.mail.getMessages({token: token, odataParams: queryParams},
      function(error, result){
        if (error) {
          console.log('getMessages returned an error: ' + error);
        }
        else if (result) {
          console.log('getMessages returned ' + result.value.length + ' messages.');
          result.value.forEach(function(message) {
            console.log('  Subject: ' + message.Subject);
            var from = message.From ? message.From.EmailAddress.Name : "NONE";
            console.log('  From: ' + from);
            console.log('  Received: ' + message.ReceivedDateTime.toString());
          });
        }
      });
      
#### Making raw API calls ####

If the library does not implement a function that does what you need, you can use the `outlook.base.makeApiCall` method to call any API call implemented on the server. See the implementations of any methods in the `outlook.mail`, `outlook.calendar`, or `outlook.contacts` namespaces for an example of how to use this method.

### Old interface ###

> As a reminder, the old interface is no longer being developed. It's recommended that you use the new interface.

You can create an `OutlookServices.Client` object like so:

    var outlookClient = new outlook.Microsoft.OutlookServices.Client('https://outlook.office365.com/api/v1.0',  
      authHelper.getAccessTokenFn('https://outlook.office365.com/', session)); 

Where `authHelper.getAccessTokenFn` is a callback method you implement to provide the needed OAuth2 access token.

---
_Source: https://npm.io/package/outlook · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
