Skip to content

IAdmO365Tenant

The IAdmO365Tenant interface represents a Microsoft 365 tenant in Adaxes.

Inheritance: The IAdmO365Tenant interface inherits from the IAdmTop interface.

Methods

  • Method

  • Description

  • FindAssociatedObjects()

  • Returns an instance of the IAdmDirectorySearch interface that can be used to find all Active Directory objects associated with the Microsoft 365 tenant.

  • ReloadData()

  • Reloads the cache of information related to the Microsoft 365 tenant.

  • SetCredentials()

  • Sets credentials of the user account that Adaxes will use to perform operations within the Microsoft 365 tenant.

Properties

  • Property

  • Description

  • AssociatedScopeItems

  • Gets a collection of activity scope items that comprise the tenant scope.

  • CompanyInfo

  • Gets the IAdmO365TenantCompanyInfo interface that contains information about the company that owns the Microsoft 365 tenant.

  • Priority

  • Gets or sets a value that specifies the priority of the Microsoft 365 tenant.

  • SynchronizePasswords

  • Gets or sets a value that indicates whether user passwords in Microsoft 365 should be automatically set or updated once a new user is created or a password is changed with the help of Adaxes.

  • DisplayTemporaryPasswords

  • Gets or sets a value that indicates whether temporary passwords generated by Microsoft 365 for new Microsoft 365 users will be displayed in the Adaxes Execution Log.

  • EmailTemporaryPasswords

  • Gets or sets a value that indicates whether temporary passwords generated automatically by Microsoft 365 for new Microsoft 365 users will be sent to the emails specified in the TemporaryPasswordsRecipients property.

  • TemporaryPasswordsRecipients

  • Gets or sets a semicolon separated list of email addresses to which temporary passwords will be sent if the EmailTemporaryPasswords property is set to TRUE.

  • Skus

  • Gets an array of Microsoft 365 plans available in the tenant.

  • TenantName

  • Gets or sets the name of the tenant.

  • UserName

  • Gets the ID of the Microsoft 365 account used by Adaxes to perform operations within the tenant.

Details

FindAssociatedObjects()

Returns an instance of the IAdmDirectorySearch interface that can be used to find all Active Directory objects associated with the Microsoft 365 tenant.

Object FindAssociatedObjects()

Examples

The following code sample outputs Active Directory objects associated with a Microsoft 365 tenant.

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

$tenantName = "My Company"

# 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)

# Bind to the tenant
$tenant = $configurationContainer.GetObject("adm-O365Tenant", "CN=$tenantName")

# Retrieve an interface to search for associated objects
$associatedObjectsSeacher = $tenant.FindAssociatedObjects()

# Set search parameters
$associatedObjectsSeacher.PageSize = 500

try
{
    # Execute search
    $searchResultIterator = $associatedObjectsSeacher.ExecuteSearch()
    $searchResults = $searchResultIterator.FetchAll()

    foreach ($searchResult in $searchResults)
    {
        Write-Host "`t" $searchResult.Name 
    }
}
finally
{
    # Release resources used by the search
    $searchResultIterator.Dispose()
}
using System;
using Softerra.Adaxes.Adsi;
using Softerra.Adaxes.Interop.Adsi;
using Softerra.Adaxes.Interop.Adsi.CloudServices.Office365;
using Softerra.Adaxes.Interop.Adsi.PersistentObjects;

class Program
{
    static void Main(string[] args)
    {
        const string tenantName = "My Company";

        // 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");
        IADsContainer configurationContainer = (IADsContainer)admService.OpenObject(
            configurationContainerPath, null, null, 0);

        // Bind to the tenant
        IAdmO365Tenant tenant = (IAdmO365Tenant)configurationContainer.GetObject(
            "adm-O365Tenant", "CN=" + tenantName);

        // Retrieve an interface to search for associated objects
        IAdmDirectorySearcher associatedObjectsSeacher = 
            (IAdmDirectorySearcher)tenant.FindAssociatedObjects();

        // Set search parameters
        associatedObjectsSeacher.PageSize = 500;

        // Execute search
        using (IAdmSearchResultIterator searchResultIterator = 
            associatedObjectsSeacher.ExecuteSearch())
        {   
            AdmSearchResult[] searchResults = searchResultIterator.FetchAll();

            foreach (AdmSearchResult searchResult in searchResults)
            {
                Console.WriteLine("\t" + searchResult.Name);
            }
        }
    }
}

ReloadData()

Reloads the cache of information related to the Microsoft 365 tenant. The cache includes the Microsoft 365 plans available in the tenant, domains registered for the tenant, and also company information, such as company name, city, etc.

void ReloadData()

SetCredentials()

Sets credentials of the user account that Adaxes will use to perform operations within the Microsoft 365 tenant.

void SetCredentials(String username, 
                    String password, 
                    Boolean checkOnly)

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.
  • checkOnly – If set to TRUE, the method only checks whether the specified user has sufficient permissions within the Microsoft 365 tenant. If a user with insufficient permissions is specified, the method throws a COMException with the UNWILLING_TO_PERFORM error code.

Remarks

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.

Examples

The following code sample changes administrative credentials for a Microsoft 365 tenant in Adaxes.

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

$tenantName = "My Company"
$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)

# Bind to the Microsoft 365 tenant
$tenant = $configurationContainer.GetObject("adm-O365Tenant", "CN=$tenantName")

# Set credentials
$tenant.SetCredentials($username, $password, $False)
using System;
using Softerra.Adaxes.Adsi;
using Softerra.Adaxes.Interop.Adsi;
using Softerra.Adaxes.Interop.Adsi.CloudServices.Office365;
using Softerra.Adaxes.Interop.Adsi.PersistentObjects;

class Program
{
    static void Main(string[] args)
    {
        const string tenantName = "My Company";
        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");
        IADsContainer configurationContainer = (IADsContainer)admService.OpenObject(
            configurationContainerPath, null, null, 0);

        // Bind to the Microsoft 365 tenant
        IAdmO365Tenant tenant = (IAdmO365Tenant)configurationContainer.GetObject(
            "adm-O365Tenant", "CN=" + tenantName);

        // Set credentials
        tenant.SetCredentials(username, password, false);
    }
}

AssociatedScopeItems

Gets a collection of activity scope items that comprise the tenant scope. Each item in the collection supports the IAdmActivityScopeItem interface.


CompanyInfo

Gets the IAdmO365TenantCompanyInfo interface that contains information about the company that owns the Microsoft 365 tenant.


Priority

Gets or sets a value that specifies the priority of the Microsoft 365 tenant. The value is used to identify which tenant to use when more than one tenant is associated with a user.

  • Type:
  • Int32
  • Access:
  • Read/Write

SynchronizePasswords

Gets or sets a value that indicates whether user passwords in Microsoft 365 should be automatically set or updated once a new user is created or a password is changed with the help of Adaxes.

  • Type:
  • Boolean
  • Access:
  • Read/Write

DisplayTemporaryPasswords

Gets or sets a value that indicates whether temporary passwords generated by Microsoft 365 for new Microsoft 365 users will be displayed in the Adaxes Execution Log.

  • Type:
  • Boolean
  • Access:
  • Read/Write

EmailTemporaryPasswords

Gets or sets a value that indicates whether temporary passwords generated automatically by Microsoft 365 for new Microsoft 365 users will be sent to the emails specified in the TemporaryPasswordsRecipients property.

  • Type:
  • Boolean
  • Access:
  • Read/Write

TemporaryPasswordsRecipients

Gets or sets a semicolon separated list of email addresses to which temporary passwords will be sent if the EmailTemporaryPasswords property is set to TRUE. You can use value references (e.g. %mail%) to specify the addresses. Value references will be replaced with corresponding property values of the user whose Microsoft 365 account is activated.

  • Type:
  • String
  • Access:
  • Read/Write

Skus

Gets an array of Microsoft 365 plans available in the tenant.


TenantName

Gets or sets the name of the tenant.

  • Type:
  • String
  • Access:
  • Read/Write

UserName

Gets the ID of the Microsoft 365 account used by Adaxes to perform operations within the tenant.

  • Type:
  • String
  • Access:
  • Read-only

Requirements

Minimum required version: 2014.1

See also