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. You can use:

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

Request headers

  • Name

  • Required

  • Description

  • Adm-Authorization

  • True

  • Specify an access token.

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
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
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
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
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-ACCESS-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-ACCESS-TOKEN);

        // Make request
        string response = await client.GetStringAsync(requestUrl.ToString());
        Console.WriteLine(response);
    }
}
cURL
curl  --header 'Adm-Authorization: YOUR-ACCESS-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
async function getExchangeRecipientInfo() {
    // Request parameters
    const userIdentifier = encodeURIComponent("CN=John Smith,CN=Users,DC=example,DC=com");
    
    const baseUrl = "https://host.example.com/restapi";
    const endpoint = "/api/directoryObjects/exchange/recipientInfo";
    const queryParams = `?directoryobject=${userIdentifier}`;
    const requestPath = `${baseUrl}${endpoint}${queryParams}`;

    // Make request
    const response = await fetch(requestPath, {
        method: "GET",
        headers: { "Adm-Authorization": "YOUR-ACCESS-TOKEN" }
    });

    if (!response.ok) {
        throw new Error(`Request failed with status ${response.status}`);
    }

    const result = await response.json();
    console.log(result);
}

getExchangeRecipientInfo();
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-ACCESS-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