IAdmM365ServiceStateRequirement
The IAdmM365ServiceStateRequirement interface represents requirements to the state of a Microsoft 365 service that should be satisfied to meet the If is licensed for Microsoft 365 condition.
Properties
-
Property
-
Description
-
Enabled
-
Gets or sets a value that indicates whether to check the service state or not.
-
ServiceState
-
Gets or sets the service state required to meet the condition.
-
CanBeChecked
-
Gets the value that indicates whether the service is available in at least one license plan.
-
Service
-
Gets or sets a Microsoft 365 service that must be enabled or disabled to meet the condition.
Details
Enabled
Gets or sets a value that indicates whether to check the service state or not. If set to false, the service state is ignored.
- Type:
- bool
- Access:
- Read/Write
ServiceState
Gets or sets the service state required to meet the condition. If set to true, the service must be enabled for a user. If set to false, the service must be disabled.
- Type:
- bool
- Access:
- Read/Write
CanBeChecked
Gets the value that indicates whether the service is available at least in one license plan in any Microsoft 365 tenant registered in Adaxes.
- Type:
- bool
- Access:
- Read-only
Service
Gets or sets a Microsoft 365 service that must be enabled or disabled to meet the condition.
- Type:
- IAdmM365Service
- Access:
- Read/Write
Examples
The following code sample creates a condition that returns true if the Exchange Online (Plan 2) service is enabled for a user.
- PowerShell
-
# The $actionSet variable refers to an action set in a # business rule, custom command, or scheduled task. # Create condition. $condition = $actionSet.Conditions.CreateEx("adm-O365LicenseCondition") $microsoft365LicenseCondition = $condition.GetCondition() $microsoft365LicenseCondition.ConditionType = "ADM_M365ACCOUNT_CONDITION_TYPE_SERVICESPECIFIC" $serviceRequirements = $microsoft365LicenseCondition.ServiceRequirements foreach ($requirement in $serviceRequirements) { if ($requirement.Service.ServiceName -eq "EXCHANGE_S_ENTERPRISE") { $requirement.Enabled = $true $requirement.ServiceState = $true break } } $microsoft365LicenseCondition.ServiceRequirements = $serviceRequirements # Save changes. $condition.SetCondition($microsoft365LicenseCondition) $condition.SetInfo() $actionSet.Conditions.Add($condition) - C#
-
// The actionSet variable refers to an action set in a // business rule, custom command, or scheduled task. // Create condition. IAdmBusinessRuleCondition condition = (IAdmBusinessRuleCondition)actionSet.Conditions.CreateEx( "adm-O365LicenseCondition"); IAdmM365LicenseCondition microsoft365LicenseCondition = (IAdmM365LicenseCondition)condition.GetCondition(); microsoft365LicenseCondition.ConditionType = ADM_M365ACCOUNT_CONDITION_TYPE_ENUM.ADM_M365ACCOUNT_CONDITION_TYPE_SERVICESPECIFIC; IAdmM365ServiceStateRequirement[] serviceRequirements = microsoft365LicenseCondition.ServiceRequirements; foreach (IAdmM365ServiceStateRequirement requirement in serviceRequirements) { if (requirement.Service.ServiceName == "EXCHANGE_S_ENTERPRISE") { requirement.Enabled = true; requirement.ServiceState = true; break; } } microsoft365LicenseCondition.ServiceRequirements = serviceRequirements; // Save changes. condition.SetCondition(microsoft365LicenseCondition); condition.SetInfo(); actionSet.Conditions.Add(condition);
Requirements
Minimum required version: 2023