Skip to content

IAdmO365Account

The IAdmO365Account interface is designed to manage properties of a Microsoft 365 account associated with an Active Directory user.

Inheritance: The IAdmO365Account interface inherits from the IUnknown interface.

Methods

Properties

  • Property

  • Description

  • AssociatedTenantDN

  • Gets the distinguished name (DN) of the Microsoft 365 tenant associated with the user.

Details

GetOffice365Properties()

The method is deprecated and should not be used. Use the IAdmO365Account2::GetOffice365Properties2 method instead.

Returns properties of the Microsoft 365 account associated with the user.

IAdmO365AccountProperties GetOffice365Properties()

Examples

The following code sample outputs user’s location, sign-in status, and assigned Microsoft 365 licenses.

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

$userDN = "CN=John Smith,CN=Users,DC=domain,DC=com"

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

# Bind to the user
$user = $admService.OpenObject("Adaxes://$userDN", $NULL, $NULL, 0)

# Get Microsoft 365 account properties
$microsoft365Properties = $user.GetOffice365Properties()

# Location
Write-Host "Location:" $microsoft365Properties.Location

# Sign-in status
Write-Host "Sign-in blocked:" $microsoft365Properties.SignInBlocked

# Assigned licenses
$licenses = $microsoft365Properties.Licenses
Write-Host "Assigned licenses:"
foreach ($license in $licenses)
{
    if ($license.Assigned)
    {
        Write-Host "`t" $license.Sku.DisplayName
    }
}
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 userPath = "Adaxes://CN=John Smith,CN=Users,DC=domain,DC=com";

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

        // Bind to the user
        IAdmO365Account user = (IAdmO365Account)admService.OpenObject(userPath, null, null, 0);

        // Get Microsoft 365 account properties
        IAdmO365AccountProperties microsoft365Properties = user.GetOffice365Properties();

        // Location
        Console.WriteLine("Location: " + microsoft365Properties.Location);

        // Sign-in status
        Console.Write("Sign-in blocked: " + microsoft365Properties.SignInBlocked);

        // Assigned licenses
        IAdmO365License[] licenses = microsoft365Properties.Licenses;
        Console.WriteLine("Assigned licenses:");
        foreach (IAdmO365License license in licenses)
        {
            if (license.Assigned)
            {
                Console.WriteLine("\t " + license.Sku.DisplayName);
            }
        }
    }
}

SetOffice365Properties()

Sets properties of the Microsoft 365 account associated with the user.

void SetOffice365Properties(IAdmO365AccountProperties properties)

Parameters

The properties parameter specifies which Microsoft 365 account properties are modified, and their values.

Remarks

You can create an instance of the IAdmO365AccountProperties interface using the AdmO365AccountProperties class. Alternatively, you can call the IAdmO365Account2::GetOffice365Properties2 method to retrieve current Microsoft 365 properties of the user account.

Examples

The following code sample revokes all Microsoft 365 licenses and blocks user access to their Microsoft 365 account.

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

$userDN = "CN=John Smith,CN=Users,DC=domain,DC=com"

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

# Bind to the user
$user = $admService.OpenObject("Adaxes://$userDN", $NULL, $NULL, 0)

# Create an instance of the AdmO365AccountProperties class
$microsoft365Properties = New-Object "Softerra.Adaxes.Adsi.CloudServices.Office365."

# Revoke all licenses
$microsoft365Properties.RevokeAllLicenses = $True

# Set sign-in status to Blocked
$microsoft365Properties.SignInBlocked = $True

# Modify Microsoft 365 account properties
$user.SetOffice365Properties($microsoft365Properties)

# Commit changes
$user.SetInfo()
using Softerra.Adaxes.Adsi;
using Softerra.Adaxes.Adsi.CloudServices.Office365;
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 userPath = "Adaxes://CN=John Smith,CN=Users,DC=domain,DC=com";

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

        // Bind to the user
        IAdmO365Account user = (IAdmO365Account)admService.OpenObject(userPath, null, null, 0);

        // Create an instance of the AdmO365AccountProperties class
        IAdmO365AccountProperties microsoft365Properties = new ;

        // Revoke all licenses
        microsoft365Properties.RevokeAllLicenses = true;

        // Set sign-in status to Blocked
        microsoft365Properties.SignInBlocked = true;

        // Modify Microsoft 365 account properties
        user.SetOffice365Properties(microsoft365Properties);

        // Commit changes
        IAdmTop user2 = (IAdmTop)user;
        user2.SetInfo();
    }
}

AssociatedTenantDN

Gets the distinguished name (DN) of the Microsoft 365 tenant associated with the user.

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

Requirements

Minimum required version: 2014.1

See also