October 9th, 2017

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

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": "العربية (البحرين)"
    },
    ...
  ]
}