on 05-17-2011 6:04 AM
Hai,
I have created leave approval form. Once the leave status are approved this details should be mailed to HR department. How to send mail ?
Thanks in advance.
Hi
Try this code for sending message
Dim oCmpSrv As SAPbobsCOM.CompanyService
Dim oMessageService As MessagesService
Dim oMessage As Message
Dim oRecipientCollection As RecipientCollection
'get company service
oCmpSrv = oCompany.GetCompanyService
'get msg service
oMessageService = oCmpSrv.GetBusinessService(ServiceTypes.MessagesService)
'get the data interface for the new message
oMessage = oMessageService.GetDataInterface(MessagesServiceDataInterfaces.msdiMessage)
'fill subject
oMessage.Subject = "Subject"
'fill text
oMessage.Text = "Message Body"
'Add Recipient
oRecipientCollection = oMessage.RecipientCollection
'Add new a recipient
oRecipientCollection.Add()
'send internal message
oRecipientCollection.Item(0).UserType = BoMsgRcpTypes.rt_InternalUser
oRecipientCollection.Item(0).UserCode = "User Code"
oRecipientCollection.Item(0).SendInternal = BoYesNoEnum.tYES
oRecipientCollection.Item(0).SendEmail = SAPbobsCOM.BoYesNoEnum.tNO
oMessage.Priority = SAPbobsCOM.BoMsgPriorities.pr_High
'send the message
oMessageService.SendMessage(oMessage)
Hope this helps you
Regards
Arun
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hai,
It shows error as
-->'Subject' is not a member of 'System.Windows.Forms.Message'.
--> 'Text' is not a member of 'System.Windows.Forms.Message'.
at 'fill subject
oMessage.Subject = "Subject"
'fill text
oMessage.Text = "Message Body"
Im using VB.Net Windows applications.
how to overcome this.Thanks
Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
If pVal.FormUID = "shift" Then
If pVal.BeforeAction = True Then
Select Case pVal.EventType
Case SAPbouiCOM.BoEventTypes.et_CLICK
Try
Dim oCmpSrv As SAPbobsCOM.CompanyService
Dim oMessageService As SAPbobsCOM.MessagesService
Dim oMessage As Message
Dim oRecipientCollection As SAPbobsCOM.RecipientCollection
'get company service
oCmpSrv = ocompany.GetCompanyService
'get msg service
oMessageService = oCmpSrv.GetBusinessService(SAPbobsCOM.ServiceTypes.MessagesService)
'get the data interface for the new message
oMessage = oMessageService.GetDataInterface(SAPbobsCOM.MessagesServiceDataInterfaces.msdiMessage)
'fill subject
oMessage.Subject = "Subject"_-->shows error here_
'fill text
oMessage.text = "Message Body" -->shows error here
'Add Recipient
oRecipientCollection = oMessage.Msg
'Add new a recipient
oRecipientCollection.Add()
'send internal message
oRecipientCollection.Item(0).UserType = SAPbobsCOM.BoMsgRcpTypes.rt_InternalUser
oRecipientCollection.Item(0).UserCode = "User Code"
oRecipientCollection.Item(0).SendInternal = SAPbobsCOM.BoYesNoEnum.tYES
oRecipientCollection.Item(0).SendEmail = SAPbobsCOM.BoYesNoEnum.tNO
oMessage = SAPbobsCOM.BoMsgPriorities.pr_High
'send the message
oMessageService.SendMessage(oMessage)
Catch ex As Exception
End Try
Thanks.
User | Count |
---|---|
97 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.