Get Exchange recipient information

Retrieves Exchange recipient information about a directory object.

GET ~/api/directoryObjects/exchange/recipientInfo?<parameters>

Query parameters

  • Name

  • Required

  • Type

  • Description

  • directoryobject

  • True

  • string

  • The identifier of the directory object to get Exchange recipient information about. An object can be identified by:

     Distinguished name (DN) {.black}
    # Example
    CN=John Smith,CN=Users,DC=example,DC=com
    
     Globally unique identifier (GUID) {.black}
    # Example
    7a4267ce-d354-44e7-8bd6-c681f1284a41
    
     Security identifier (SID) {.black}
    # Example
    S-1-5-21-3635565734-1729062999-1822655016-1627
    

Request headers

  • Name

  • Required

  • Description

  • Adm-Authorization

  • True

  • Specify the security token obtained during authentication.

Request body

Do not send a body with this request.

Responses

If successful, returns 200 OK status code and a RecipientInfo object in the response body. Otherwise, returns one of the common HTTP error codes and an error description in the response body.

RecipientInfo is a JSON object with the following data structure:

{
    "recipientType": "<type>",
    "recipientLocation": "<location>",
    "exchangeVersion": "<version>",
    "mailboxType": "<mailboxType>"
}

recipientType enum
The Exchange recipient type.

 Show possible enum values {.black}
None             = 0,  // The object is neither mail-enabled, nor has a mailbox
MailEnabled      = 1,  // The recipient is mail-enabled
MailboxEnabled   = 2,  // The recipient has an Exchange mailbox
Corrupted        = 3   // Exchange properties are present, but the recipient type cannot be recognized

recipientLocation enum
Indicates whether the recipient is located online or on-premises.

 Show possible enum values {.black}
None        = 0,  // The object is not an Exchange recipient
OnPremise   = 1,  // The recipient is hosted in Exchange on-premises
Office365   = 2,  // The recipient is hosted in Exchange Online
External    = 3   // The recipient is located in an external Exchange organization

exchangeVersion enum
The Exchange server version.

 Show possible enum values {.black}
Unknown          = 0,  
Exchange2003     = 1, 
Exchange2007     = 2,  
Exchange2010     = 3,  
Exchange2013     = 4,
Exchange2016     = 5,  
Exchange2019     = 6,  
ExchangeOnline   = 1000

mailboxType enum
The mailbox type.

 Show possible enum values {.black}
None           = 0, // Not a mailbox
User           = 1, // User mailbox
Shared         = 2, // Shared mailbox
Linked         = 3, // Linked mailbox
Room           = 4, // Room mailbox
Equipment      = 5, // Equipment mailbox
PublicFolder   = 6, // Public folder mailbox
System         = 7  // System mailbox

Examples

 Retrieve Exchange recipient information about a user

The following code sample retrieves the recipient information about a user who has an on-premises regular mailbox.

Request

PowerShell
$baseUrl = "https://host.example.com/restApi"
$endpoint = "/api/directoryObjects/exchange/recipientInfo"

# Request parameters
$requestUrl = $baseUrl + $endpoint
$requestHeaders = @{"Adm-Authorization" = YOUR-SECURITY-TOKEN}
$userIdentifier = "CN=John Smith,CN=Users,DC=example,DC=com"
$queryParams = @{"directoryobject" = $userIdentifier}

# Make request
Invoke-RestMethod -Method GET -Headers $requestHeaders -Uri $requestUrl -Body $queryParams
C#
using System;
using System.Net.Http;
using System.Threading.Tasks;

class Program
{
    static async Task Main()
    {
        const string baseUrl = "https://host.example.com";
        const string endpoint = "/restApi/api/directoryObjects/exchange/recipientInfo";            
        
        // Request parameters
        const string userIdentifier = "CN=John Smith,CN=Users,DC=example,DC=com";
        UriBuilder requestUrl = new()
        {
            Host = baseUrl + endpoint,
            Query = $"?directoryObject={userIdentifier}"
        };   

        // Initialize HTTP client
        using HttpClient client = new();
        client.DefaultRequestHeaders.Add("Adm-Authorization", YOUR-SECURITY-TOKEN);

        // Make request
        string response = await client.GetStringAsync(requestUrl.ToString());
        Console.WriteLine(response);
    }
}
cURL
curl  --header 'Adm-Authorization: YOUR-SECURITY-TOKEN' \
--get -X GET 'https://host.example.com/restApi/api/directoryObjects/exchange/recipientInfo' \
--data-urlencode 'directoryobject=CN=John Smith,CN=Users,DC=example,DC=com'
node.js
var https = require('https');

// Request parameters
var userIdentifier = "CN=John Smith,CN=Users,DC=example,DC=com";
var requestPath = "/restApi/api/directoryObjects/exchange/recipientInfo"
    + `?directoryobject=${userIdentifier}`;

var options = {
    method: "GET",
    hostname: "host.example.com",
    path: encodeURI(requestPath),
    headers: {'Adm-Authorization': 'YOUR-SECURITY-TOKEN'}
};

// Make request
var req = https.request(options, res => {
    var data = [];

    res.on("data", chunk => {
        data.push(chunk);
    });

    res.on("end", () => {
        var body = Buffer.concat(data);
        console.log(body.toString());
    });

    res.on("error", error => {
        console.error(error);
    });
});
req.end();
Python
import requests
import json

baseUrl = "https://host.example.com/restApi"
endpoint = "/api/directoryObjects/exchange/recipientInfo"

# Request parameters
requestUrl = baseUrl + endpoint
requestHeaders = {"Adm-Authorization": YOUR-SECURITY-TOKEN}
queryParams = {"directoryobject": "CN=John Smith,CN=Users,DC=example,DC=com"}

# Make request
request = requests.get(requestUrl, headers=requestHeaders, params=queryParams)
response = json.loads(request.content)
print(response)

Response

HTTP Status code: 200 OK
Response body:

{
    "recipientType": 2,
    "recipientLocation": 1,
    "exchangeVersion": 6,
    "mailboxType": 1
}

See also