cancel
Showing results for 
Search instead for 
Did you mean: 

How to use Message obj in B1

Former Member
0 Kudos

hi all

i have a requirement in which i have to use message object of DI api but i am unable to use it.

plz anybody tell me how to use this object and how to send mails via B1.

Thanks

vishwas srivastava

View Entire Topic
barend_morkel2
Active Contributor
0 Kudos

Private Sub btnSendMsg_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSendMsg.Click

Dim oMessage As SAPbobsCOM.Messages

'Get a new message object

oMessage = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oMessages)

'Assign some header data

oMessage.Subject = "Hello SDK"

oMessage.MessageText = "SKD Test Message"

oMessage.Priority = SAPbobsCOM.BoMsgPriorities.pr_Low

'Add valid recipients (can be more than one) and add the message

oMessage.Recipients.UserCode = oCompany.UserName

'oMessage.Recipients.NameTo = oCompany.UserName

oMessage.Recipients.SendInternal = SAPbobsCOM.BoYesNoEnum.tYES

'Mail - if you don't supply the mail address

'here, SBO will use the users defined e-mail

'address in Administration-Definitions-General-Def Users

'oMessage.Recipients.EmailAddress = ...

oMessage.Recipients.SendEmail = SAPbobsCOM.BoYesNoEnum.tYES

'Add the recipient record

oMessage.Recipients.Add()

' Adding the new order document

lRetCode = oMessage.Add

'Check Return Code

If lRetCode <> 0 Then

oCompany.GetLastError(lErrCode, sErrMsg)

MsgBox("Error : " & lErrCode & " : " & sErrMsg)

Else

MsgBox("Added Message")

End If

oMessage = Nothing

End Sub

NB -> you have to set up the SBO Mailer service -> supply your smtp server address

Former Member
0 Kudos

thanx dear for your valuable help this has helped me a lot in understanding the mailing concept in B1,

and i am know also able to send mails internally

but dear there is still a problem that i want to send

external mails although you have given a note in your mail but i am unalbe to utilize it.

so dear plz tell me how to do the required setting (SMPT mailer address) in SBO (where to find it)

that you have mentioned in the mail.

Thanks.

AlexGrebennikov
Active Contributor
0 Kudos

Hi Vishwas!

>> ..plz tell me how to do the required setting (SMPT mailer address)..

SysTray -> SBO Service Manager -> SBO Mailer -> Settings

Former Member
0 Kudos

thanx dear

but in my SBO manager there is no SBO mailer option

can u tell what error posibility is there, and how to overcome it.

AlexGrebennikov
Active Contributor
0 Kudos

You can find installer for <b>Server Tools</b> on SBO CD.

barend_morkel2
Active Contributor
0 Kudos

You'll have to re-install the entire SBO (server side included).

When installing the server tools - select custom installation and tick the SBO mailer option (with the default installation it is not ticked)