AxMmServer.Message
In C#, VB.Net, C++ and other compiled languages the namespace for most classes is AXMMCFGLib instead of AxMmServer. For interpreted languages like VBScript, JavaScript or Powershell it is AxMmServer.
Property | Type | Read/Write | Description |
ID | Number | Read | ID of the message |
DirectionID | String | Read/Write | Message direction. Incoming or outgoing |
TypeID | String | Read | Message Type. |
StatusID | String | Read/Write | Status of a message |
TriggerStatusID | String | Read/Write | Trigger status |
AckStatusID | String | Read/Write | Acknowledge status |
ChannelID | String | Read/Write | Channel ID of the channel that sent/received the message |
BillingID | String | Read/Write | Billing ID used for accounting |
ScheduledTime | DateTime | Read/Write | When to send the message |
SentTime | DateTime | Read/Write | When the message was sent |
ReceivedTime | DateTime | Read/Write | When the message was received |
LastUpdate | DateTime | Read/Write | When the message record was last updated |
Priority | Number | Read/Write | The message priority. |
BatchID | Number | Read/Write | User field |
ConversationID | Number | Read/Write | User field |
Hash | String | Read/Write | The hash of a message |
Creator | String | Read/Write | The creator of the message |
Archive | Boolean | Read/Write | System field |
Trace | String | Read/Write | A trace of the current message |
CustomField1 | Number | Read/Write | User field |
CustomField2 | String | Read/Write | User field |
LastError | Number | Read/Write | Completion code of the last called function. |
Method | Description |
AddTrace | Adds a trace line to the ‘Trace’ propery. |
CountAttachments | Count the number of attachments to this message |
GetAttachmentName | Get the name of the given attachment index |
GetAttachmentSize | Get the size of the given attachment index |
AddAttachment | Add an attachment to this message |
SaveAttachment | Save an attachment to file |
ID property
ID of the message. It is the unique record ID in the Messages database.
DirectionID property
Direction of the message. Click here to see a list of valid DirectionID values.
TypeID property
Type of the message. This is either ‘SMS’, ‘EMAIL’, ‘FILE’ or ‘SMPPSERVERBIND’.
StatusID property
Status of the message. Click here here to see a list of valid StatusID values.
TriggerStatusID property
Trigger status of the message. Click here here to see a list of valid TriggerStatusID values.
AckStatusID property
Acknowledge status of the message. Click here here to see a list of valid AckStatusID values.
ChannelID property
The channel ID of the channel that sent or received the message. Set a channel ID when inserting a message to bypass the routing stage and force the message to be sent on the given channel.
BillingID property
The Billing ID is used by the SMPP Server channel to store the SystemID that sent a message.
ScheduledTime property
A message will be sent out automatically by the SMS Server when the current time is equal to or greater than the scheduled time.
SentTime property
The send time file records when the message was originally sent out by the SMS Server.
ReceivedTime property
The received time records when the message was originally received by the SMS Server.
LastUpdate property
The field always represents the time when the message record was last updated.
Priority property
The message priority. A higher number is a higher priority. This number affects the order in which messages are processed. Please not that a higher priority message cannot get in front of a queue of message that is currently being processed.
BatchID property
This field can be used to uniquely identify all messages in a specific batch. This can be used for bulk sending.
ConversationID property
This field can be used to keep track of strongly related messages. For instance to connect a delivery report to the original message or to keep messages in an quest/response chain associated with each other.
Hash property
This field is used by GSM and POP3 channels to keep an SHA1 has of the messages. The hash is used to recognize if a message was already processed on a previous occasion.
Creator property
This field contains the identifier of the original creator of the message. When a message is received by a channel the channel ID will be stored here.
Archive property
This is a system field. The archiver thread in the SMS Server uses this field to claim messages for archiving.
Trace property
The message trace is a log of every significant event that has happened to this message. This is a multiline field where each line contains a datetime and a trace string.
CustomField1 property
Custom number field. You can use this field to attach data related to your own business logic to a message.
CustomField2 property
Custom string field. You can use this field to attach data related to your own business logic to a message.
LastError property
The last error code. This property is used in combination with any of the methods in this class.
AddTrace method
Adds a trace line to the Trace property. You do not need to add date and time, it will be done by the AddTrace function itself.
Parameters:
The String that needs to be traced
Return value:
None
Example:
Set objMessageDB = CreateObject( "AxMmServer.MessageDB" )
Set objConstants = CreateObject( "AxMmServer.Constants" )
Set objMessage = objMessageDB.FindFirstMessage( "", "" ) ' Find first message
WScript.Echo "FindFirstMessage, result: " & objMessageDB.LastError
If( objMessageDB.LastError <> 0 ) Then
objMessageDB.Close
WScript.Quit
End If
WScript.Echo "Trace: " & objMessage.Trace
objMessage.AddTrace( "Hello, world" )
WScript.Echo vbCrLf
WScript.Echo "Trace: " & objMessage.Trace
objMessageDB.Save( objMessage ) ' Save the modified message
CountAttachments method
Count the number of attachments to this message. Only messages of type E-mail can have attachments.
Parameters:
None
Return value:
Number of attachments
Example:
Set objMessageDB = CreateObject( "AxMmServer.MessageDB" )
Set objConstants = CreateObject( "AxMmServer.Constants" )
Set objMessage = objMessageDB.Create(objConstants.MESSAGETYPE_EMAIL)
objMessage.AddAttachment("G:\MmServer\test\Test.pdf")
WScript.Echo "Add Attachment Result: " & objMessage.LastError
Dim n, i
i = objMessage.CountAttachments
For i = 0 To n
objMessage.SaveAttachment i, "G:\MmServer\test\Test2.pdf"
Next
GetAttachmentName method
Get the name of the give attachment index. This is usually the filename.
Parameters:
Attachment index
Return value:
Name of attachment
Example:
Set objMessageDB = CreateObject( "AxMmServer.MessageDB" )
Set objConstants = CreateObject( "AxMmServer.Constants" )
' ...
Dim n, i
i = objMessage.CountAttachments
For i = 0 To n
WScript.Echo objMessage.GetAttachmentName(i)
WScript.Echo objMessage.GetAttachmentSize(i)
objMessage.SaveAttachment i, "G:\MmServer\test\Test2.pdf"
Next
GetAttachmentSize method
Get the size of the give attachment index.
Parameters:
Attachment index
Return value:
Size of attachment
Example:
Set objMessageDB = CreateObject( "AxMmServer.MessageDB" )
Set objConstants = CreateObject( "AxMmServer.Constants" )
' ...
Dim n, i
i = objMessage.CountAttachments
For i = 0 To n
WScript.Echo objMessage.GetAttachmentName(i)
WScript.Echo objMessage.GetAttachmentSize(i)
objMessage.SaveAttachment i, "G:\MmServer\test\Test2.pdf"
Next
AddAttachment method
Add an attachment to this message. The attachment is loaded from file and kept in memory until the message is saved.
Parameters:
Filepath
Return value:
None
Example:
Set objMessageDB = CreateObject( "AxMmServer.MessageDB" )
Set objConstants = CreateObject( "AxMmServer.Constants" )
Set objMessage = objMessageDB.Create(objConstants.MESSAGETYPE_EMAIL)
objMessage.AddAttachment("G:\MmServer\test\Test.pdf")
WScript.Echo "Add Attachment Result: " & objMessage.LastError
Dim n, i
i = objMessage.CountAttachments
For i = 0 To n
objMessage.SaveAttachment i, "G:\MmServer\test\Test2.pdf"
Next
SaveAttachment method
Save an attachment to file.
Parameters:
Index
Filepath
Return value:
None
Example:
Set objMessageDB = CreateObject( "AxMmServer.MessageDB" )
Set objConstants = CreateObject( "AxMmServer.Constants" )
Set objMessage = objMessageDB.Create(objConstants.MESSAGETYPE_EMAIL)
objMessage.AddAttachment("G:\MmServer\test\Test.pdf")
WScript.Echo "Add Attachment Result: " & objMessage.LastError
Dim n, i
i = objMessage.CountAttachments
For i = 0 To n
objMessage.SaveAttachment i, "G:\MmServer\test\Test2.pdf"
Next