Hi,
Problem - I need to send an email with following details ->
- Sender = A queue (i have the GUID)
- To = a List of "systemUsers" (i have the list)
- template = I have template GUID
I cant find the code or any example for this.
Can someone help?
Here is the current code which i am using ( i am using a "systemUser" as Sender here, i need to use queue) -->
Public Sub SendEmailUsingTemplate(ByVal templateId As Guid, ByVal fromUser As Guid, _
ByVal toUsers As System.Collections.Generic.List(Of System.Guid?)) _
Implements ICrmRepository.SendEmailUsingTemplate
Dim toParties As List(Of Entity) = New List(Of Entity)
For Each id In toUsers
Dim toParty = New Entity("activityparty")
toParty("partyid") = New EntityReference("systemuser", id.Value)
toParties.Add(toParty)
Next
Dim fromParty = New Entity("activityparty")
fromParty("partyid") = New EntityReference("systemuser", fromUser)
'Changed
Dim newEmail = New Entity("email")
newEmail("to") = toParties.ToArray
newEmail("from") = fromParty
'Dim targetEmail As TargetSendFromTemplateEmail = New TargetSendFromTemplateEmail()
'targetEmail.Email = newEmail
Dim templateRequest As SendEmailFromTemplateRequest = New SendEmailFromTemplateRequest
templateRequest.Target = newEmail
templateRequest.TemplateId = templateId
templateRequest.RegardingType = "systemuser"
templateRequest.RegardingId = fromUser
_crmDataContextProvider.GetCrmService().Execute(templateRequest)
End Sub
VB.net or C# ( both languages are welcomed)
Regards
Sagar