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
$userIdentifier = "CN=John Smith,CN=Users,DC=example,DC=com"

$baseUrl = "https://host.example.com/restApi"
$endpoint = "/api/directoryObjects/exchange/recipientInfo"
$requestParams = "?directoryobject=$userIdentifier"  
$requestUrl = $baseUrl + $endpoint + $requestParams
$requestHeaders = @{"Adm-Authorization"="HxtdAPz73OFfae7....w7lQvxjJHIbVqgkCtPtLD"}

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

class Program
{
    static async Task Main()
    {
        const string userIdentifier = "CN=John Smith,CN=Users,DC=example,DC=com";
        const string token = "HxtdAPz73OFfae7....w7lQvxjJHIbVqgkCtPtLD";

        UriBuilder requestUrl = new UriBuilder(
            "https://host.example.com/restApi/api/directoryObjects/exchange/recipientInfo");
        requestUrl.Query += $"?directoryObject={userIdentifier}";

        // Initialize HTTP client
        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Adm-Authorization", token);

            // Make request
            string response = await client.GetStringAsync(requestUrl.ToString());
            Console.WriteLine(response);
        }
    }
}
cURL
curl  --header 'Adm-Authorization: HxtdAPz73OFfae7....w7lQvxjJHIbVqgkCtPtLD' \
--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 userIdentifier = "CN=John Smith,CN=Users,DC=example,DC=com";

var https = require("https");

// Request parameters and headers
var requestPath = "/restApi/api/directoryObjects/exchange/recipientInfo"
    + `?directoryobject=${userIdentifier}`;

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

// Make request
var req = https.request(options, function (res) {
    var chunks = [];

    res.on("data", function (chunk) {
        chunks.push(chunk);
    });

    res.on("end", function (chunk) {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
    });

    res.on("error", function (error) {
        console.error(error);
    });
});

req.end();

Response

HTTP Status code: 200 OK
Response body:

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

See also