Skip to content

IAdmSendSmsSettings

The IAdmSendSmsSettings interface is used to manage SMS settings of Adaxes service.

Inheritance: The IAdmSendSmsSettings interface inherits from the IUnknown interface.

Note

To use the IAdmSendSmsSettings interface:

  1. Create an instance of the AdmSendSmsSettings class that implements the interface.
  2. Load properties to the new instance from the SMS Settings container. To do so, you need to bind to the container using the “SmsSettings” alias.

How

Methods

  • Method

  • Description

  • Load()

  • Loads SMS settings from the specified directory object.

  • Save()

  • Saves SMS settings to the specified directory object.

Properties

  • Property

  • Description

  • Enabled

  • Gets or sets a value that indicates whether sending SMS messages is enabled.

  • MobileNumberProperty

  • Gets or sets the name of the AD object property that stores mobile phone numbers to send SMS messages to.

  • MessageMaxLength

  • Gets or sets the maximum allowed length of SMS messages.

  • GatewaySettings

  • Gets or sets SMS gateway settings.

Details

Load()

Loads SMS settings from the specified directory object.

void Load(IAdmTop object)

Parameters

By default, the object parameter should refer to the SMS Settings container.

Examples

The following code sample outputs the name of the property used to store mobile phone numbers.

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

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

# Create an instance of the AdmSendSmsSettings class
$sendSmsSettings = New-Object "Softerra.Adaxes.Management.AdmSendSmsSettings"

# Load SMS settings
$smsSettingsPath = $admService.Backend.GetConfigurationContainerPath("SmsSettings")
$smsSettingsContainer = $admService.OpenObject($smsSettingsPath, $NULL, $NULL, 0)
$sendSmsSettings.Load($smsSettingsContainer)

# Output the property name
Write-Host "Property used to store mobile phone numbers:" $sendSmsSettings.MobileNumberProperty
using System;
using Softerra.Adaxes.Adsi;
using Softerra.Adaxes.Interop.Adsi;
using Softerra.Adaxes.Interop.Adsi.PersistentObjects;
using Softerra.Adaxes.Management;

class Program
{
    static void Main(string[] args)
    {
        // Connect to the Adaxes service
        AdmNamespace adsNS = new AdmNamespace();
        IAdmService admService = adsNS.GetServiceDirectly("localhost");

        // Create an instance of the AdmSendSmsSettings class
        AdmSendSmsSettings sendSmsSettings = new AdmSendSmsSettings();

        // Load SMS Settings
        String smsSettingsPath = admService.Backend.GetConfigurationContainerPath("SmsSettings");
        IAdmTop smsSettingsContainer = (IAdmTop)admService.OpenObject(smsSettingsPath, null, null, 0);
        sendSmsSettings.Load(smsSettingsContainer);

        // Output the property name
        Console.WriteLine("Property that is used to store mobile phone numbers: " + sendSmsSettings.MobileNumberProperty);
    }
}

Save()

Saves SMS settings to the specified directory object.

void Save(IAdmTop object)

Parameters

By default, the object parameter should refer to the SMS Settings container.

Remarks

To propagate the changes to the directory, call IADs::SetInfo on the object after calling this method.

Examples

The following code sample sets the maximum length of SMS messages to 200.

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

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

# Create an instance of the AdmSendSmsSettings class
$sendSmsSettings = New-Object "Softerra.Adaxes.Management.AdmSendSmsSettings"

# Load SMS settings
$smsSettingsPath = $admService.Backend.GetConfigurationContainerPath("SmsSettings")
$smsSettingsContainer = $admService.OpenObject($smsSettingsPath, $NULL, $NULL, 0)
$sendSmsSettings.Load($smsSettingsContainer)

# Set the maximum SMS message length
$sendSmsSettings.MessageMaxLength = 200

# Save the changes
$sendSmsSettings.Save($smsSettingsContainer)
$smsSettingsContainer.SetInfo()
using System;
using Softerra.Adaxes.Adsi;
using Softerra.Adaxes.Interop.Adsi;
using Softerra.Adaxes.Interop.Adsi.PersistentObjects;
using Softerra.Adaxes.Management;

class Program
{
    static void Main(string[] args)
    {
        // Connect to the Adaxes service
        AdmNamespace adsNS = new AdmNamespace();
        IAdmService admService = adsNS.GetServiceDirectly("localhost");

        // Create an instance of the AdmSendSmsSettings class
        AdmSendSmsSettings sendSmsSettings = new AdmSendSmsSettings();

        // Load SMS Settings
        String smsSettingsPath = admService.Backend.GetConfigurationContainerPath("SmsSettings");
        IAdmTop smsSettingsContainer = (IAdmTop)admService.OpenObject(smsSettingsPath, null, null, 0);
        sendSmsSettings.Load(smsSettingsContainer);

        // Set the maximum SMS message length
        sendSmsSettings.MessageMaxLength = 200;

        // Save the changes
        sendSmsSettings.Save(smsSettingsContainer);
        smsSettingsContainer.SetInfo();
    }
}

Enabled

Gets or sets a value that indicates whether sending SMS messages is enabled.

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

MobileNumberProperty

Gets or sets the name of the AD object property that stores mobile phone numbers to send SMS messages to.

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

MessageMaxLength

Gets or sets the maximum allowed length of SMS messages. Messages that exceed the limit are truncated by Adaxes.

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

GatewaySettings

Gets or sets SMS gateway settings.

Remarks

The property supports different interfaces depending on the SMS gateway type specified in the IAdmSendSmsGatewaySettings::GatewayType property. If the SMS gateway type is ADM_SMSGATEWAYTYPE_EMAIL, this property supports the IAdmSendSmsEmailGatewaySettings interface. If the SMS gateway type is ADM_SMSGATEWAYTYPE_HTTP, this property supports the IAdmSendSmsHttpGatewaySettings interface.

To specify settings for an SMS gateway, you need to create an instance of a class that implements the corresponding interface. The IAdmSendSmsEmailGatewaySettings interface is implemented by the AdmSendSmsEmailGatewaySettings class and the IAdmSendSmsHttpGatewaySettings interface is implemented by the AdmSendSmsHttpGatewaySettings class

Examples

The following code sample outputs the HTTP request body if SMS gateway type is HTTP to SMS.

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

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

# Create an instance of the AdmSendSmsSettings class
$sendSmsSettings = New-Object "Softerra.Adaxes.Management.AdmSendSmsSettings"

# Load SMS settings
$smsSettingsPath = $admService.Backend.GetConfigurationContainerPath("SmsSettings")
$smsSettingsContainer = $admService.OpenObject($smsSettingsPath, $NULL, $NULL, 0)
$sendSmsSettings.Load($smsSettingsContainer)

# Get SMS gateway provider settings
$gatewaySettings = $sendSmsSettings.GatewaySettings

if ($gatewaySettings.GatewayType -eq "ADM_SMSGATEWAYTYPE_HTTP")
{
    Write-Host "Body:" $gatewaySettings.Body
}

The following code sample configures settings of an Email to SMS gateway provider.

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

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

# Create an instance of the AdmSendSmsSettings class
$sendSmsSettings = New-Object "Softerra.Adaxes.Management.AdmSendSmsSettings"

# Enable SMS
$sendSmsSettings.Enabled = $True

# Create an instance of the AdmSendSmsEmailGatewaySettings class
$emailGatewaySettings = New-Object "Softerra.Adaxes.Management.AdmSendSmsEmailGatewaySettings"

# Specify the e-mail address in the To field
$emailGatewaySettings.To = "%mobilenumber%@example.com"

# Specify the body
$emailGatewaySettings.Body = "Message:%smstext%"

# Set SMS gateway settings
$sendSmsSettings.GatewaySettings = $emailGatewaySettings

# Save the changes
$smsSettingsPath = $admService.Backend.GetConfigurationContainerPath("SmsSettings")
$smsSettingsContainer = $admService.OpenObject($smsSettingsPath, $NULL, $NULL, 0)
$sendSmsSettings.Save($smsSettingsContainer)
$smsSettingsContainer.SetInfo()

Requirements

Minimum required version: 2017.1

See also