You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> Legacy Exchange tokens are deprecated. Starting February 2025, we'll begin to turn off legacy Exchange [user identity](../outlook/authentication.md#exchange-user-identity-token) and [callback](../outlook/authentication.md#callback-tokens) tokens for Exchange Online tenants. For the timeline and details, see our [FAQ page](../outlook/faq-nested-app-auth-outlook-legacy-tokens.md). This is part of [Microsoft's Secure Future Initiative](https://blogs.microsoft.com/on-the-issues/2023/11/02/secure-future-initiative-sfi-cybersecurity-cyberattacks/), which gives organizations the tools needed to respond to the current threat landscape. Exchange user identity tokens will still work for Exchange on-premises. Nested app authentication is the recommended approach for tokens going forward.
2
+
> Legacy Exchange tokens are deprecated. Legacy Exchange [user identity](../outlook/authentication.md#exchange-user-identity-token) and [callback](../outlook/authentication.md#callback-tokens) tokens have been turned off for most Exchange Online tenants. Administrators can reenable legacy tokens for tenants and add-ins until June 2025. In October 2025, legacy tokens will be completely turned off for all tenants. For the timeline and details, see our [FAQ page](../outlook/faq-nested-app-auth-outlook-legacy-tokens.md). This is part of [Microsoft's Secure Future Initiative](https://blogs.microsoft.com/on-the-issues/2023/11/02/secure-future-initiative-sfi-cybersecurity-cyberattacks/), which gives organizations the tools needed to respond to the current threat landscape. Exchange user identity tokens will still work for Exchange on-premises. Nested app authentication is the recommended approach for tokens going forward.
title: Use the Microsoft Graph REST API from an Outlook add-in
3
+
description: Learn how to use the Outlook mail REST API from an Outlook add-in with Microsoft Graph.
4
+
ms.date: 04/22/2025
5
+
ms.topic: how-to
6
+
ms.localizationpriority: medium
7
+
---
8
+
9
+
# Use the Microsoft Graph REST API from an Outlook add-in
10
+
11
+
The Outlook JavaScript API (Office.js) retrieves the properties of messages and appointments and run operations on these items in your add-in. However, there may be instances where the data you need isn't available through the API. For example, your add-in may need to implement single sign-on or identify messages in a user's mailbox that originated from the same sender. To get the information you need, use the [Outlook mail REST API](/graph/api/resources/mail-api-overview) through [Microsoft Graph](/graph/overview).
12
+
13
+
## Get started
14
+
15
+
To make calls to the Microsoft Graph API in Office Add-ins, implement the [nested app authentication (NAA)](../develop/enable-nested-app-authentication-in-your-add-in.md) solution to request a token.
Once you have an access token, you can then use it to call Microsoft Graph.
22
+
23
+
The Microsoft Graph API consists of the v1.0 and beta endpoints. Note the following about the endpoint pattern.
24
+
25
+
-`version` specifies the `v1.0` or `beta` API.
26
+
-`resource` specifies the resource your add-in interacts with, such as a user, group, or site.
27
+
-`query_parameters` specifies parameters to customize your request. For example, you can filter the messages returned to only those from a specific sender.
Copy file name to clipboardExpand all lines: docs/outlook/use-rest-api.md
+8-6Lines changed: 8 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: Use the Outlook REST APIs from an Outlook add-in
3
3
description: Learn how to use the Outlook REST APIs from an Outlook add-in to get an access token.
4
-
ms.date: 02/12/2024
4
+
ms.date: 04/22/2025
5
5
ms.topic: how-to
6
6
ms.localizationpriority: medium
7
7
---
@@ -11,14 +11,16 @@ ms.localizationpriority: medium
11
11
The [Office.context.mailbox.item](/javascript/api/requirement-sets/outlook/preview-requirement-set/office.context.mailbox.item) namespace provides access to many of the common fields of messages and appointments. However, in some scenarios an add-in may need to access data that isn't exposed by the namespace. For example, the add-in may rely on custom properties set by an outside app, or it needs to search the user's mailbox for messages from the same sender. In these scenarios, the [Outlook REST APIs](/outlook/rest) is the recommended method to retrieve the information.
12
12
13
13
> [!IMPORTANT]
14
-
> **Outlook REST v2.0 and beta endpoints deprecation**
14
+
> **Outlook REST v2.0 and beta endpoints are deprecated**
15
15
>
16
-
> The Outlook REST v2.0 and beta endpoints will be [fully deprecated on March 31, 2024](https://devblogs.microsoft.com/microsoft365dev/outlook-rest-api-v2-0-and-beta-endpoints-decommissioning-update/). However, privately released and AppSource-hosted add-ins are able to use the REST service until [extended support ends for Outlook 2019 on October 14, 2025](/lifecycle/end-of-support/end-of-support-2025). Traffic from these add-ins is automatically identified for exemption. This exemption also applies to new add-ins developed after the decommission date.
16
+
> The Outlook REST v2.0 and beta endpoints are now [deprecated](https://devblogs.microsoft.com/microsoft365dev/final-reminder-outlook-rest-api-v2-0-and-beta-endpoints-decommissioning/). However, privately released and AppSource-hosted add-ins are still able to use the REST service until [extended support ends for Outlook 2019 on October 14, 2025](/lifecycle/end-of-support/end-of-support-2025). Traffic from these add-ins is automatically identified for exemption. This exemption also applies to new add-ins developed after March 31, 2024.
17
17
>
18
-
> Although add-ins are able to use the REST service until 2025, we highly encourage you to migrate your add-ins to use [Microsoft Graph](/outlook/rest#outlook-rest-api-via-microsoft-graph). For guidance, see [Compare Microsoft Graph and Outlook REST API endpoints](/outlook/rest/compare-graph).
18
+
> Although add-ins are able to use the REST service until October 2025, we highly encourage you to migrate your add-ins to use [Microsoft Graph](microsoft-graph.md).
The Outlook REST APIs require a bearer token in the `Authorization` header. Typically apps use OAuth2 flows to retrieve a token. However, add-ins can retrieve a token without implementing OAuth2 by using the new [Office.context.mailbox.getCallbackTokenAsync](/javascript/api/requirement-sets/outlook/preview-requirement-set/office.context.mailbox#methods) method introduced in the Mailbox requirement set 1.5.
23
25
24
26
By setting the `isRest` option to `true`, you can request a token compatible with the REST APIs.
@@ -117,5 +119,5 @@ function getCurrentItem(accessToken) {
117
119
118
120
## See also
119
121
120
-
-For an example that calls the REST APIs from an Outlook add-in, see [command-demo](https://github.com/OfficeDev/outlook-add-in-command-demo) on GitHub.
121
-
-Outlook REST APIs are also available through the Microsoft Graph endpoint but there are some key differences, including how your add-in gets an access token. For more information, see [Outlook REST API via Microsoft Graph](/outlook/rest/index#outlook-rest-api-via-microsoft-graph).
0 commit comments