web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Send Email using an email Template -- Sender should be a queue

(0) ShareShare
ReportReport
Posted on by

Hi,

Problem - I need to send an email with following details ->

  1. Sender = A queue (i have the GUID)
  2. To = a List of "systemUsers" (i have the list)
  3. 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

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    Please refer to this link

    msdn.microsoft.com/.../gg334461.aspx

  • Samhitha Nittala Profile Picture
    75 on at

    Hi Sagar,

    Were you able to send email of behalf of queue by just giving the queue Id?

    I have the same requirement but even I am assigning from party to queue id the email is still getting created with the user context.

    Any inputs?

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at

    Hello ,

    You may get some coding help from below link.

    [View:https://mayankp.wordpress.com/2011/10/08/crm-2011-removing-email-from-queue/]

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans