Skip to content

IAdmSmsOps

The IAdmSmsOps interface is used to send SMS messages via Adaxes.

Inheritance: The IAdmSmsOps interface inherits from the IUnknown interface.

Note

All directory objects in Adaxes implement the IAdmSmsOps interface. To use this interface, you need to bind to a directory object you want to send an SMS message to.

How

Methods

  • Method

  • Description

  • SendSms()

  • Sends an SMS message with the specified text to the recipient represented by this directory object.

  • SendSmsEx()

  • Sends an SMS message with the specified text to the given mobile phone numbers.

  • EnsureMobileNumberSpecified()

  • Verifies whether a mobile phone number is specified for the directory object.

  • IsSmsSettingsConfigured()

  • Verifies whether SMS settings are configured to send SMS messages via the Adaxes service.

Properties

Details

SendSms()

Sends an SMS message with the specified text to the recipient represented by this directory object. The mobile phone number is obtained from the property of the directory object that is specified in the MobileNumberPropertyName property.

void SendSms(String smsText, Boolean async)

Parameters

  • smsText - Specifies the text of the SMS message to send. You can use value references (e.g. %name%, %unicodePwd%) in the text. Value references will be replaced with corresponding property values of the directory object that represents the recipient.
  • async - Specifies whether the SMS message will be sent asynchronously.

Examples

The following code sample sends an SMS message to a user.

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

$smsText = "Hello %name%, your password expires on %adm-PasswordExpires%."

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

# Bind to user
$userDN = "CN=John Smith,CN=Users,DC=domain,DC=com"
$user = $admService.OpenObject("Adaxes://$userDN", $NULL, $NULL, 0)

# Send SMS message
$sendAsynchronously = $False
$user.SendSms($smsText, $sendAsynchronously)
using System;
using Softerra.Adaxes.Interop.Adsi;
using Softerra.Adaxes.Adsi;
using Softerra.Adaxes.Interop.Adsi.PersistentObjects;

class Program
{
    static void Main(string[] args)
    {
        const String smsText = "Hello %name%, your password expires on %adm-PasswordExpires%.";

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

        // Bind to user
        const String userPath = "Adaxes://CN=John Smith,CN=Users,DC=domain,DC=com";
        IAdmSmsOps user = (IAdmSmsOps)admService.OpenObject(userPath, null, null, 0);

        // Send SMS message
        const Boolean sendAsynchronously = false;
        user.SendSms(smsText, sendAsynchronously);
    }
}

SendSmsEx()

Sends an SMS message with the specified text to the given mobile phone numbers.

void SendSmsEx(String mobileNumbers,
               String smsText,
               Boolean async)

Parameters

  • mobileNumbers - A semicolon-separated list of mobile phone numbers of the recipients. You can use value references (e.g. %mobile%) in the value for this parameter. Value references will be replaced with corresponding property values of the directory object that implements this interface.
  • smsText - Specifies the text of the SMS message to send. You can use value references (e.g. %name%, %unicodePwd%) in the text. Value references will be replaced with corresponding property values of the directory object that implements this interface.
  • async - Specifies whether the SMS message will be sent asynchronously.

Examples

The following code sample sends an SMS message to mobile phone numbers stored in the otherMobile property of a user.

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

$smsText = "Hello %name%, your password expires on %adm-PasswordExpires%."

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

# Bind to user
$userDN = "CN=John Smith,CN=Users,DC=domain,DC=com"
$user = $admService.OpenObject("Adaxes://$userDN", $NULL, $NULL, 0)

# Get mobile phone numbers stored in the otherMobile property
$otherMobile = $user.GetEx("otherMobile")
$otherMobile = $otherMobile -Join ";"

# Send SMS message
$sendAsynchronously = $False
$user.SendSmsEx($otherMobile, $smsText, $sendAsynchronously)
using System;
using System.Linq;
using Softerra.Adaxes.Interop.Adsi;
using Softerra.Adaxes.Adsi;
using Softerra.Adaxes.Interop.Adsi.PersistentObjects;

class Program
{
    static void Main(string[] args)
    {
        const String smsText = "Hello %name%, your password expires on %adm-PasswordExpires%.";

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

        // Bind to user
        const String userPath = "Adaxes://CN=John Smith,CN=Users,DC=domain,DC=com";
        IADs user = (IADs)admService.OpenObject(userPath, null, null, 0);

        // Get mobile phone numbers stored in the otherMobile property
        object[] otherMobile = (object[])user.GetEx("otherMobile");
        String otherMobile2 = String.Join(";", otherMobile.Cast<string>().ToArray());

        // Send SMS message
        IAdmSmsOps user2 = (IAdmSmsOps)user;
        const Boolean sendAsynchronously = false;
        user2.SendSmsEx(otherMobile2, smsText, sendAsynchronously);
    }
}

EnsureMobileNumberSpecified()

Verifies whether a mobile phone number is specified for the directory object.

void EnsureMobileNumberSpecified()

Exceptions

  • COMException
  • Mobile phone number is not specified.

IsSmsSettingsConfigured()

Verifies whether SMS settings are configured to send SMS messages via the Adaxes service.

Boolean IsSmsSettingsConfigured()

MobileNumberPropertyName

Gets the name of the property that is used to store mobile phone numbers for directory objects.

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

Requirements

Minimum required version: 2011.3

See also