IAdmM365Sku
The IAdmM365Sku interface represents a Microsoft 365 license plan. License plans are stored as directory objects at Adaxes Configuration Server (AD LDS).
Inheritance: IAdmTop
Methods
-
Method
-
Description
-
ValidateServices()
-
Checks whether the specified set of Microsoft 365 services can be assigned to a user.
Properties
-
Property
-
Description
-
SkuId
-
Gets the unique identifier of the Microsoft 365 plan within the tenant.
-
AccountSkuId
-
Gets the ID of the plan that is unique outside the tenant.
-
SkuPartNumber
-
Gets the name of the Microsoft 365 plan (e.g. ENTERPRISEPACK).
-
TotalUnits
-
Gets the total number of licenses available in the Microsoft 365 plan.
-
ConsumedUnits
-
Gets the number of licenses currently assigned to users.
-
CustomDisplayName
-
Gets or sets a custom display name for the Microsoft 365 plan.
-
DefaultDisplayName
-
Gets a default display name that is used to represent the Microsoft 365 plan.
-
Enabled
-
Gets or sets a value that indicates whether the Microsoft 365 plan is enabled in Adaxes and its licenses can be assigned to users.
-
Services
-
Gets or sets a list of services available in the Microsoft 365 plan.
Details
ValidateServices()
Checks whether the specified set of Microsoft 365 services can be assigned to a user.
bool ValidateServices(IAdmM365Service[] services, out string warning)
Parameters
- services – Specifies the set of services to validate.
- warning – An output (OUT) parameter that returns a message indicating which services in the set cannot be assigned, and why.
Return value
The method returns false
if validation failed. In that case, the warning parameter contains the list of services that cannot be assigned, and also the services that need to be included into the set and/or enabled for successful validation.
Remarks
When validating services in the set, the method takes into account the availability of all dependent services in the set as well as their status (enabled or disabled). For example, if the Office Web Apps service is included in the set and enabled, the method checks whether the SharePoint Online service it depends on, is also present in the set and enabled.
Examples
The following code sample validates services in all Microsoft 365 license plans available in a tenant.
- PowerShell
-
[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi") $tenantName = "MyTenant" # Connect to the Adaxes service $ns = New-Object "Softerra.Adaxes.Adsi.AdmNamespace" $service = $ns.GetServiceDirectly("localhost") # Bind to the 'Microsoft 365' container $configurationContainerPath = $service.Backend.GetConfigurationContainerPath("CloudServicesO365") $configurationContainer = $service.OpenObject($configurationContainerPath, $null, $null, 0) # Bind to the Microsoft 365 tenant $tenant = $configurationContainer.GetObject("adm-O365Tenant", "CN=$tenantName") # Validate services foreach ($sku in $tenant.Skus) { $warning = [System.String]::Empty if ($sku.ValidateServices($sku.Services, [ref]$warning)) { Write-Host "Validation of the " $sku.DefaultDisplayName "plan succeeded" continue } Write-Host "Validation of the " $sku.DefaultDisplayName "plan failed" Write-Host "`tReason:" $warning }
- C#
-
using System; using Softerra.Adaxes.Adsi; using Softerra.Adaxes.Interop.Adsi; using Softerra.Adaxes.Interop.Adsi.Microsoft365; using Softerra.Adaxes.Interop.Adsi.PersistentObjects; class Program { static void Main(string[] args) { const string tenantName = "MyTenant"; // Connect to the Adaxes service AdmNamespace ns = new AdmNamespace(); IAdmService service = ns.GetServiceDirectly("localhost"); // Bind to the 'Microsoft 365' container string configurationContainerPath = service.Backend.GetConfigurationContainerPath( "CloudServicesO365"); IADsContainer configurationContainer = (IADsContainer)service.OpenObject( configurationContainerPath, null, null, 0); // Bind to the Microsoft 365 tenant IAdmM365Tenant tenant = (IAdmM365Tenant)configurationContainer.GetObject("adm-O365Tenant", "CN=" + tenantName); // Validate services foreach (IAdmM365Sku sku in tenant.Skus) { string warning; if (sku.ValidateServices(sku.Services, out warning)) { Console.WriteLine("Validation of the " + sku.DefaultDisplayName + " plan succeeded"); continue; } Console.WriteLine("Validation of the " + sku.DefaultDisplayName + " plan failed"); Console.WriteLine("\tReason: " + warning); } } }
SkuId
Gets the unique identifier of the Microsoft 365 plan within the tenant.
- Type:
- string
- Access:
- Read-only
AccountSkuId
Gets the ID of the plan that is unique outside the tenant.
- Type:
- string
- Access:
- Read-only
SkuPartNumber
Gets the name of the Microsoft 365 plan (e.g. ENTERPRISEPACK).
- Type:
- string
- Access:
- Read-only
TotalUnits
Gets the total number of licenses available in the Microsoft 365 plan.
- Type:
- int
- Access:
- Read-only
ConsumedUnits
Gets the number of licenses currently assigned to users.
- Type:
- int
- Access:
- Read-only
CustomDisplayName
Gets or sets a custom display name for the Microsoft 365 plan.
- Type:
- string
- Access:
- Read/Write
Remarks
If the property is empty, Adaxes uses the name specified in the DefaultDisplayName
property to represent the Microsoft 365 plan.
DefaultDisplayName
Gets a default display name that is used to represent the Microsoft 365 plan.
- Type:
- string
- Access:
- Read-only
Remarks
If the CustomDisplayName
property is set, Adaxes uses the name specified in it to represent the plan.
Enabled
Gets or sets a value that indicates whether the Microsoft 365 plan is enabled in Adaxes and its licenses can be assigned to users.
- Type:
- bool
- Access:
- Read/Write
Services
Gets or sets a list of services available in the Microsoft 365 plan.
- Type:
- IAdmM365Service[]
- Access:
- Read/Write
Examples
The following example outputs all available Microsoft 365 services and their status.
- PowerShell
-
[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi") # Connect to the Adaxes service $ns = New-Object "Softerra.Adaxes.Adsi.AdmNamespace" $service = $ns.GetServiceDirectly("localhost") # Bind to the 'Microsoft 365' container $configurationContainerPath = $service.Backend.GetConfigurationContainerPath("CloudServicesO365") $configurationContainer = $service.OpenObject($configurationContainerPath, $null, $null, 0) foreach ($tenant in $configurationContainer) { # Output tenant name Write-Host "Tenant name:" $tenant.TenantName # Get license plans associated with the tenant $skus = $tenant.Skus foreach ($sku in $skus) { Write-Host "`tPlan:" $sku.DefaultDisplayName # Output information about each service $services = $sku.Services Write-Host "`tServices:" foreach ($service in $services) { Write-Host "`t`tDisplay name:" $service.ServiceDisplayName Write-Host "`t`tEnabled:" $service.Enabled Write-Host } Write-Host } }
- C#
-
using System; using Softerra.Adaxes.Adsi; using Softerra.Adaxes.Interop.Adsi; using Softerra.Adaxes.Interop.Adsi.Microsoft365; using Softerra.Adaxes.Interop.Adsi.PersistentObjects; class Program { static void Main(string[] args) { // Connect to the Adaxes service AdmNamespace ns = new AdmNamespace(); IAdmService service = ns.GetServiceDirectly("localhost"); // Bind to the 'Microsoft 365' container string configurationContainerPath = service.Backend.GetConfigurationContainerPath( "CloudServicesO365"); IADsContainer configurationContainer = (IADsContainer)service.OpenObject( configurationContainerPath, null, null, 0); foreach (IAdmM365Tenant tenant in configurationContainer) { // Output tenant name Console.WriteLine("Tenant name: " + tenant.TenantName); // Get license plans associated with the tenant IAdmM365Sku[] skus = tenant.Skus; foreach (IAdmM365Sku sku in skus) { Console.WriteLine("\tDisplay name: " + sku.DefaultDisplayName); // Output information about each service IAdmM365Service[] services = sku.Services; Console.WriteLine("\tServices:"); foreach (IAdmM365Service service365 in services) { Console.WriteLine("\t\tDisplay name: " + service365.ServiceDisplayName); Console.WriteLine("\t\tEnabled: " + service365.Enabled); Console.WriteLine(); } Console.WriteLine(); } } } }
Requirements
Minimum required version: 2023