IAdmSmsOps3
The IAdmSmsOps3 interface extends the IAdmSmsOps interface.
Inheritance: IAdmSmsOps2
Methods
-
Method
-
Description
-
GetMessageMaxLength()
-
Returns the maximum number of characters in SMS messages.
-
SendSms2()
-
Sends an SMS message with the specified text to the recipient represented by this directory object.
-
SendSmsEx2()
-
Sends an SMS message with the specified text to the given mobile phone numbers.
Details
GetMessageMaxLength()
Returns the maximum number of characters in SMS messages. Messages that exceed the limit are truncated by Adaxes.
Int32 GetMessageMaxLength()
SendSms2()
Sends an SMS message with the specified text to the recipient represented by this directory object. Unlike the IAdmSmsOps::SendSms method, this method returns a response from the SMS gateway provider. The mobile phone number is obtained from the property of the directory object specified by the IAdmSmsOps::MobileNumberPropertyName property.
String SendSms2(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 should be sent asynchronously. If set to TRUE the method returns NULL.
Return value
Response from the SMS gateway provider. For Email to SMS gateway providers, the method always returns NULL.
Examples
The following code sample sends an SMS message to a user and outputs the response.
- Powershell
-
[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 $response = $user.SendSms2($smsText, $sendAsynchronously) # Output the response Write-Host "Response: $response"
- C#
-
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"; IAdmSmsOps3 user = (IAdmSmsOps3)admService.OpenObject(userPath, null, null, 0); // Send SMS message const Boolean sentAsynchronously = false; string response = user.SendSms2(smsText, sentAsynchronously); // Output the response Console.WriteLine("Response " + response); } }
SendSmsEx2()
Sends an SMS message with the specified text to the given mobile phone numbers. Unlike the IAdmSmsOps::SendSmsEx method, this method returns a response from the SMS gateway provider.
String SendSmsEx2(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 of the 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 represents the recipient.
- async - Specifies whether the SMS message should be sent asynchronously. If set to TRUE the method returns NULL.
Return value
Response from the SMS gateway provider. For Email to SMS gateway providers, the method always returns NULL.
Examples
The following code sample sends an SMS message to mobile phone numbers stored in the otherMobile property of a user and outputs the response.
- Powershell
-
[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 $response = $user.SendSmsEx2($otherMobile, $smsText, $sendAsynchronously) # Output the response Write-Host "Response: $response"
- C#
-
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 IAdmSmsOps3 user2 = (IAdmSmsOps3)user; const Boolean sentAsynchronously = false; string response = user2.SendSmsEx2(otherMobile2, smsText, sentAsynchronously); // Output the response Console.WriteLine("Response: " + response); } }
Requirements
Minimum required version: 2017.1