Skip to content

IAdmO365Container

The IAdmO365Container interface represents the container where Microsoft 365 tenants are stored. The container is located at the Adaxes Configuration Server (AD LDS).

Inheritance: The IAdmO365Container interface inherits from the IAdmTop interface.

Note

To get an instance of the IAdmO365Container interface, you need to bind to the Microsoft 365 container using the “CloudServicesO365” alias.

Methods

  • Method

  • Description

  • HasTenants()

  • Checks whether there are any Microsoft 365 tenants registered in Adaxes.

  • HasTenantsWithExchange()

  • Checks whether there is at least one registered Microsoft 365 tenant that provides access to Exchange Online.

  • EnsureCanRegisterTenant()

  • Checks whether the current user has sufficient permissions to register a Microsoft 365 tenant.

  • EnsurePowerShellModuleInstalled()

  • Checks whether the Microsoft Azure Active Directory Module for Windows PowerShell is installed on the computer where the Adaxes service is running.

  • RegisterTenant()

  • Registers a new Microsoft 365 tenant in Adaxes.

  • GetRegisteredSkus()

  • Gets a list of Microsoft 365 license plans available in all Microsoft 365 tenants registered in Adaxes.

  • GetRegisteredServices()

  • Gets Microsoft 365 services provided by Microsoft 365 license plans in all registered tenants.

Details

HasTenants()

Checks whether there are any Microsoft 365 tenants registered in Adaxes.

Boolean HasTenants()

HasTenantsWithExchange()

Checks whether there is at least one registered Microsoft 365 tenant that provides access to Exchange Online.

Boolean HasTenantsWithExchange()

EnsureCanRegisterTenant()

Checks whether the current user has sufficient permissions to register a Microsoft 365 tenant. If the user has insufficient permissions, the method throws a COMException with the UNWILLING_TO_PERFORM error code.

void EnsureCanRegisterTenant()

EnsurePowerShellModuleInstalled()

Checks whether the Microsoft Azure Active Directory Module for Windows PowerShell is installed on the computer where the Adaxes service is running. If the module is not installed, the method throws a COMException with the UNWILLING_TO_PERFORM error code.

void EnsurePowerShellModuleInstalled()

RegisterTenant()

Registers a new Microsoft 365 tenant in Adaxes.

IAdmO365Tenant RegisterTenant(String username, String password)

Parameters

  • username – Specifies the ID of the Microsoft 365 account that will be used by Adaxes to perform operations within the tenant. The ID consists of a Microsoft 365 user name and your Microsoft 365 domain name (e.g. administrator@company.onmicrosoft.com).
  • password – Specifies the password to use with the user ID provided in the username parameter.

Remarks

  • The tenant to register is determined based on the Microsoft 365 account specified.
  • The specified Microsoft 365 account must be assigned to either of the following roles in Microsoft 365:
    • Global Administrator or
    • User Management Administrator and Exchange Administrator.

Return value

The method returns the IAdmO365Tenant interface that represents the new Microsoft 365 tenant.

Examples

The following code sample registers a new Microsoft 365 tenant.

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

$username = "administrator@company.onmicrosoft.com"
$password = "secret"

# Connect to the Adaxes service
$admNS = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$admService = $admNS.GetServiceDirectly("localhost")

# Bind to the 'Microsoft 365' container
$configurationContainerPath = $admService.Backend.GetConfigurationContainerPath("CloudServicesO365")
$configurationContainer = $admService.OpenObject($configurationContainerPath, $NULL, $NULL, 0)

# Register tenant
$configurationContainer.RegisterTenant($username, $password)
using System;
using Softerra.Adaxes.Adsi;
using Softerra.Adaxes.Interop.Adsi.CloudServices.Office365;
using Softerra.Adaxes.Interop.Adsi.PersistentObjects;

class Program
{
    static void Main(string[] args)
    {
        const string username = "administrator@company.onmicrosoft.com";
        const string password = "secret";

        // Connect to the Adaxes service
        AdmNamespace adsNS = new AdmNamespace();
        IAdmService admService = adsNS.GetServiceDirectly("localhost");

        // Bind to the 'Microsoft 365' container
        String configurationContainerPath = admService.Backend.GetConfigurationContainerPath(
            "CloudServicesO365");
        IAdmO365Container configurationContainer = (IAdmO365Container)admService.OpenObject(
            configurationContainerPath, null, null, 0);

        // Register tenant
        configurationContainer.RegisterTenant(username, password);
    }
}

GetRegisteredSkus()

Gets a list of Microsoft 365 license plans available in all Microsoft 365 tenants registered in Adaxes.

IAdmO365SkuInfo[] GetRegisteredSkus(Boolean enabledOnly)

Parameters

The enabledOnly parameter specifies whether to return only Microsoft 365 license plans enabled in Adaxes. A license plan is considered enabled if it is enabled at least in one tenant.

Examples

The following code sample outputs all enabled Microsoft 365 plans available in the registered Microsoft 365 tenants.

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

$enabledOnly = $True

# Connect to the Adaxes service
$admNS = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$admService = $admNS.GetServiceDirectly("localhost")

# Bind to the 'Microsoft 365' container
$configurationContainerPath = $admService.Backend.GetConfigurationContainerPath("CloudServicesO365")
$configurationContainer = $admService.OpenObject($configurationContainerPath, $NULL, $NULL, 0)

# Get enabled Microsoft 365 plans
$skuInfos = $configurationContainer.

foreach ($skuInfo in $skuInfos)
{
    Write-Host "`tDisplay name:" $skuInfo.DisplayName
    Write-Host "`tSKU ID:" $skuInfo.SkuId
    Write-Host "`tSKU Part Number:" $skuInfo.SkuPartNumber
    Write-Host
}
using System;
using Softerra.Adaxes.Adsi;
using Softerra.Adaxes.Interop.Adsi.CloudServices.Office365;
using Softerra.Adaxes.Interop.Adsi.PersistentObjects;

class Program
{
    static void Main(string[] args)
    {
        const Boolean enabledOnly = true;

        // Connect to the Adaxes service
        AdmNamespace adsNS = new AdmNamespace();
        IAdmService admService = adsNS.GetServiceDirectly("localhost");

        // Bind to the 'Microsoft 365' container
        String configurationContainerPath = admService.Backend.GetConfigurationContainerPath(
            "CloudServicesO365");
        IAdmO365Container configurationContainer = (IAdmO365Container)admService.OpenObject(
            configurationContainerPath, null, null, 0);

        // Get enabled Microsoft 365 plans
        IAdmO365SkuInfo[] skuInfos = configurationContainer.;

        foreach (IAdmO365SkuInfo skuInfo in skuInfos)
        {
            Console.WriteLine("\tDisplay name: " + skuInfo.DisplayName);
            Console.WriteLine("\tSKU ID: " + skuInfo.SkuId);
            Console.WriteLine("\tSKU Part Number: " + skuInfo.SkuPartNumber);
            Console.WriteLine();
        }
    }
}

GetRegisteredServices()

Gets Microsoft 365 services provided by Microsoft 365 license plans in all registered tenants.

IAdmO365Service[] GetRegisteredServices(Boolean enabledOnly)

Parameters

The enabledOnly parameter specifies whether to return only Microsoft 365 services enabled in Adaxes. A service is considered enabled if it is enabled at least in one tenant.

Examples

The following code sample outputs all Microsoft 365 services available in the registered Microsoft 365 tenants.

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

$enabledOnly = $False

# Connect to the Adaxes service
$admNS = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$admService = $admNS.GetServiceDirectly("localhost")

# Bind to the 'Microsoft 365' container
$configurationContainerPath = $admService.Backend.GetConfigurationContainerPath("CloudServicesO365")
$configurationContainer = $admService.OpenObject($configurationContainerPath, $NULL, $NULL, 0)

# Output all Microsoft 365 services
$microsoft365Services = $configurationContainer.

foreach ($microsoft365Service in $microsoft365Services)
{
    Write-Host "`tService name:" $microsoft365Service.ServiceName
    Write-Host "`tService display name:" $microsoft365Service.ServiceDisplayName
    Write-Host "`tEnabled:" $microsoft365Service.Enabled
    Write-Host
}
using System;
using Softerra.Adaxes.Adsi;
using Softerra.Adaxes.Interop.Adsi.CloudServices.Office365;
using Softerra.Adaxes.Interop.Adsi.PersistentObjects;

class Program
{
    static void Main(string[] args)
    {
        const Boolean enabledOnly = false;

        // Connect to the Adaxes service
        AdmNamespace adsNS = new AdmNamespace();
        IAdmService admService = adsNS.GetServiceDirectly("localhost");

        // Bind to the 'Microsoft 365' container
        String configurationContainerPath = admService.Backend.GetConfigurationContainerPath(
            "CloudServicesO365");
        IAdmO365Container configurationContainer = (IAdmO365Container)admService.OpenObject(
            configurationContainerPath, null, null, 0);

        // Output all Microsoft 365 services
        IAdmO365Service[] microsoft365Services = configurationContainer.;

        foreach (IAdmO365Service microsoft365Service in microsoft365Services)
        {
            Console.WriteLine("\tService name: " + microsoft365Service.ServiceName);
            Console.WriteLine("\tService display name: " + microsoft365Service.ServiceDisplayName);
            Console.WriteLine("\tEnabled: " + microsoft365Service.Enabled);
            Console.WriteLine();
        }
    }
}

Requirements

Minimum required version: 2014.1

See also