Quantcast
Channel: Outlook and Exchange dev blog
Viewing all 43 articles
Browse latest View live

New Outlook APIs in the Microsoft Graph: rooms, rules, categories, headers, and time zones

$
0
0

In June, we announced new APIs in the beta endpoint of the Outlook REST API. Today we're excited to announce that those APIs have been added to the Microsoft Graph, along with some other highly-requested APIs. All of these new APIs are added to the beta version of the Microsoft Graph API.

Try these new APIs out today, either in your code or in the Graph Explorer. Leave feedback on the new APIs on UserVoice.

Rules

The Microsoft Graph API has added mailbox rule support via the Rules API. By using this API, apps can now list a user's rules and create new rules.

Get inbox rules

Request

GET https://graph.microsoft.com/beta/me/mailFolders/inbox/messagerules

Response

{
  "value": [
    {
      "id": "AQAAAPUfKuc=",
      "displayName": "Chris Gray",
      "sequence": 1,
      "isEnabled": true,
      "hasError": false,
      "isReadOnly": false,
      "conditions": {
        "fromAddresses": [
          {
            "emailAddress": {
              "name": "Chris Gray",
              "address": "chrisg@contoso.onmicrosoft.com"
            }
          }
        ]
      },
      "actions": {
        "moveToFolder": "AAMkAGZj....",
        "stopProcessingRules": true
      }
    }
  ]
}

Create inbox rule

Request

POST https://graph.microsoft.com/beta/me/mailFolders/inbox/messagerules

{
  "displayName": "From partner",
  "sequence": 2,
  "isEnabled": true,
  "conditions": {
    "senderContains": [
      "adele"
    ]
   },
   "actions": {
    "forwardTo": [
      {
       "emailAddress": {
        "name": "Alex Wilbur",
        "address": "AlexW@contoso.onmicrosoft.com"
        }
       }
    ],
    "stopProcessingRules": true
   }
}

Response

{
  "id": "AQAAAPUfKuk=",
  "displayName": "From partner",
  "sequence": 2,
  "isEnabled": true,
  "hasError": false,
  "isReadOnly": false,
  "conditions": {
    "senderContains": [
      "ADELE"
    ]
  },
  "actions": {
    "stopProcessingRules": true,
    "forwardTo": [
      {
        "emailAddress": {
          "name": "Alex Wilbur",
          "address": "AlexW@contoso.onmicrosoft.com"
        }
      }
    ]
  }
}

Categories

The Microsoft Graph API has added access to the master categories list in a user's mailbox via the Categories API. By using this API, apps can now get the user's master category list and add new categories.

Get master category list

Request

GET https://graph.microsoft.com/beta/me/outlook/masterCategories

Response

{
  "value": [
    {
      "id": "24ed9127-fe16-412d-9870-5efea8a2e8fc",
      "displayName": "Red category",
      "color": "preset0"
    },
    {
      "id": "7fd099e2-7526-4edf-98e8-35ce90277496",
      "displayName": "Orange category",
      "color": "preset1"
    },
    ...
  ]
}

Create category

Request

POST https://graph.microsoft.com/beta/me/outlook/masterCategories

{
  "displayName": "Project expenses",
  "color": "preset9"
}

Response

{
  "id": "2393a824-ec66-46fb-88c3-5b455474d57c",
  "displayName": "Project expenses",
  "color": "preset9"
}

Message headers

The Microsoft Graph API has added the RFC5322 message headers to the message resource. The headers are available in the internetMessageHeaders property, which is a collection of internetMessageHeader resources. The internetMessageHeaders property is not in the default property set for messages, so you must request it explicitly using the $select query parameter.

Get message headers

Request

GET https://graph.microsoft.com/beta/me/messages/{message-id}?$select=subject,internetMessageHeaders

Response

{
  "id": "AAMkAGZj...",
  "subject": "Vacation request",
  "internetMessageHeaders": [
    {
      "name": "MIME-Version",
      "value": "1.0"
    },
    {
      "name": "Date",
      "value": "Wed, 4 Oct 2017 10:32:27 -0400"
    },
    ...
  ]
}

Meeting rooms

The previously announced Rooms API from the Outlook endpoint is now available on the Microsoft Graph. We've added the ability to find both rooms and room lists.

Get room lists

Request

GET https://graph.microsoft.com/beta/me/findroomlists

Response

{
  "value": [
    {
      "name": "Building 1 Rooms",
      "address": "Building1Rooms@contoso.onmicrosoft.com"
    },
    {
      "name": "Building 2 Rooms",
      "address": "Building2Rooms@contoso.onmicrosoft.com"
    }
  ]
}

Get rooms

Request (all rooms)

GET https://graph.microsoft.com/beta/me/findrooms

Request (rooms in a room list)

GET https://graph.microsoft.com/beta/me/findrooms(roomlist='Building1Rooms@contoso.onmicrosoft.com')

Response

{
  "value": [
    {
      "name": "Conf Room Adams",
      "address": "Adams@contoso.onmicrosoft.com"
    },
    {
      "name": "Conf Room Crystal",
      "address": "Crystal@contoso.onmicrosoft.com"
    },
    {
      "name": "Conf Room Stevens",
      "address": "Stevens@contoso.onmicrosoft.com"
    }
  ]
}

Time zones

The previously announced Time Zones API from the Outlook endpoint is now available on the Microsoft Graph. Apps can request a list of all supported time zones from the server, in either Windows or IANA format.

Request

GET https://graph.microsoft.com/beta/me/outlook/supportedTimeZones

Response

{
  "value": [
    {
      "alias": "Dateline Standard Time",
      "displayName": "(UTC-12:00) International Date Line West"
    },
    {
      "alias": "Samoa Standard Time",
      "displayName": "(UTC+13:00) Samoa"
    },
    {
      "alias": "UTC-11",
      "displayName": "(UTC-11:00) Coordinated Universal Time-11"
    },
    {
      "alias": "Aleutian Standard Time",
      "displayName": "(UTC-10:00) Aleutian Islands"
    },
    ...
  ]
}

Languages

The previously announced Languages API from the Outlook endpoint is now available on the Microsoft Graph. With this API, apps can request a list of supported languages from the server.

Request

GET https://graph.microsoft.com/beta/me/outlook/supportedLanguages

Response

{
  "value": [
    {
      "locale": "af-ZA",
      "displayName": "Afrikaans (Suid-Afrika)"
    },
    {
      "locale": "am-ET",
      "displayName": "አማርኛ (ኢትዮጵያ)"
    },
    {
      "locale": "ar-AE",
      "displayName": "العربية (الإمارات العربية المتحدة)"
    },
    {
      "locale": "ar-BH",
      "displayName": "العربية (البحرين)"
    },
    ...
  ]
}

Announcing add-in support for Gmail accounts in Mac Outlook

$
0
0

In March, we announced support for Gmail accounts in Outlook 2016 for Mac. Today we're happy to announce preview add-in support for Gmail accounts in Outlook 2016 for Mac.

Limitations

When add-ins are loaded in a Gmail mailbox, there are a few limitations to take into account.

  • You cannot use Exchange Web Services (EWS) to access items in the Gmail mailbox. This means that you cannot use makeEwsRequestAsync or use an EWS callback token from getCallbackTokenAsync to make EWS calls directly. Instead, you can get the same type of access to the items in the mailbox by using the Outlook REST APIs.
  • You cannot get a single-sign-on token using getAccessTokenAsync. Instead, you can use the Exchange identity token.

New API features

In order to allow your add-in to determine what type of mailbox it is loaded in, we've added a new property to Office.context.mailbox.userProfile called accountType. This property is a string and can return one of the following values:

Value Description
enterprise The mailbox is on an on-premises Exchange server.
gmail The mailbox is associated with a Gmail account.
office365 The mailbox is associated with an Office 365 work or school account.
outlookCom The mailbox is associated with a personal Outlook.com account.

Note: This property is currently only implemented in Outlook 2016 for Mac.

Get access to the preview

Preview add-in support for Gmail mailboxes is available for users that are part of the Office Insider Fast program. The minimum build number is 16.9.1212.

Call to action

Other than accounting for the above limitations, there are no specific changes that need to be made in order for your add-in to work in Gmail mailboxes. However, if your add-in is listed in the Office Store, you'll need to resubmit it for validation before it will show up in the store for Gmail users.

Try your add-in with a Gmail mailbox today, and give us feedback on UserVoice.

Error improvement for invalid X-AnchorMailbox in REST API calls

$
0
0

We wanted to give you a heads-up on a recent change to the error returned by the Outlook REST API when the value of the X-AnchorMailbox is incorrect. If your app has error-handling for this scenario based on the current behavior of the service, this may be a breaking change.

Starting immediately, the service will start returning a 421 Misdirected status instead of a 503 Service Unavailable. The intent of this change is to return a more appropriate HTTP status and to make it easier for developers to detect why the request failed and fix the problem.

Old behavior

Prior to this change, sending a REST API request with an incorrect X-AnchorMailbox header would result in the following response.

HTTP/1.1 503 Service Unavailable

{
  "error": {
    "code": "MailboxInfoStale",
    "message": "Mailbox info is stale."
  }
}

New behavior

With this change, if your app receives a 421 HTTP status from a REST call, you should check the response body for an error object, then check the code property. If it is ErrorIncorrectRoutingHint, the value you sent in the X-AnchorMailbox is incorrect.

HTTP/1.1 421 Misdirected

{
  "error": {
    "code": "ErrorIncorrectRoutingHint",
    "message": "The x-anchor mailbox 'jason@contoso.com' does not match the target of the request."
  }
}

Handling the error

If your app gets this error, it is recommended that you get the user's mailbox GUID and use that for the X-AnchorMailbox value, instead of the user's SMTP address. You can get the user's mailbox GUID by making the following REST request (with no X-AnchorMailbox header):

GET https://outlook.office.com/api/v2.0/me

This will return the following response:

{
  "Id": "3c7f0e3a-623b-85ae-4032-07d41531beff@7aeb6117-c342-4861-bec7-f8803ae85e41",
  "EmailAddress": "jason@contoso.onmicrosoft.com",
  "DisplayName": "Jason Johnston",
  "Alias": "jason",
  "MailboxGuid": "fece2b65-3577-4972-bf3d-5594fc9c9f9e"
}

You would then use the value of MailboxGuid in the X-AnchorMailbox for subsequent REST calls.

GET https://outlook.office.com/api/v2.0/me/messages

X-AnchorMailbox: fece2b65-3577-4972-bf3d-5594fc9c9f9e
Viewing all 43 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>