You can easily craete and send an email activity in MS CRM 3.0 / 4.0.
If you experience "MS CRM 4.0: Generic SQL error 0x80044150" error, Please enable the impersonation in the web.config:
Here is the simple code to Create and Send Email Activity:public bool CreateAndSendEmail(Lookup EmailFrom, Lookup EmailTo, string EmailSubject, string EmailDescription, Lookup RegardingObject)
{ try { #region Create Email Object
email ObjEmail = new email();
if(EmailFrom != null)
{ activityparty ObjFrom = new activityparty(); ObjFrom.partyid = EmailFrom;
ObjEmail.from = new activityparty[] { ObjFrom }; }
activityparty ObjTo = new activityparty(); ObjTo.partyid = EmailTo;
ObjEmail.to = new activityparty[] { ObjTo };
// Assign Subject ObjEmail.subject = EmailSubject;
// Assign Description ObjEmail.description = EmailDescription;
CrmSdk.CrmBoolean direction = new CrmSdk.CrmBoolean(); direction.Value = true; ObjEmail.directioncode = direction;
//Regarding Case if(RegardingObject != null)
ObjEmail.regardingobjectid = RegardingObject;
//Create Email try { Guid EmailGuid = Service.Create(ObjEmail);
// Create a SendEmail request. SendEmailRequest emailRequest = new SendEmailRequest(); emailRequest.EmailId = EmailGuid;
emailRequest.TrackingToken = ""; emailRequest.IssueSend = true;
// Send the email message. SendEmailResponse emailResponse = (SendEmailResponse)Service.Execute(emailRequest);
return true;
}
catch (SoapException) { return false;
}
#endregion Create Email Object }
catch (SoapException) { return false;
}
}
Hope you find this code helpful.
Happy Coding.
Showing posts with label Email. Show all posts
Showing posts with label Email. Show all posts
Thursday, August 21, 2008
Create and Send Email Activity
Posted by
Dynamics 365 Solution Architect | Azure / ALM/DevOps | Power Platform
at
8:08 AM
1 comment:
Labels:
Email
Thursday, October 11, 2007
Remove / Detach Email from Queue
DetachFromQueueEmail Message
Detaches the e-mail from the specified queue.
// Use below code.
// Rreplace the WebService URL
service.Url = strWebServiceURL;
service.Credentials = System.Net.CredentialCache.DefaultCredentials;
DetachFromQueueEmailRequest objEmail = new DetachFromQueueEmailRequest();
// Assign Email GUID
objEmail.EmailId = new Guid(strEmailGUID.Trim());
// Assign Queue GUID
objEmail.QueueId = new Guid(QueueIdNode.InnerText.Trim().ToString());
service.Execute(objEmail);
Is it so simple..........right.
Detaches the e-mail from the specified queue.
// Use below code.
// Rreplace the WebService URL
service.Url = strWebServiceURL;
service.Credentials = System.Net.CredentialCache.DefaultCredentials;
DetachFromQueueEmailRequest objEmail = new DetachFromQueueEmailRequest();
// Assign Email GUID
objEmail.EmailId = new Guid(strEmailGUID.Trim());
// Assign Queue GUID
objEmail.QueueId = new Guid(QueueIdNode.InnerText.Trim().ToString());
service.Execute(objEmail);
Is it so simple..........right.
Tuesday, August 7, 2007
E-mail activities are not automatically sent to the recipients when you distribute e-mail activities for a campaign in Microsoft Dynamics CRM
SYMPTOMS
When you distribute e-mail activities for a campaign in Microsoft Dynamics CRM, the e-mail activities are not automatically sent to the recipients. Instead, you have to open each e-mail activity. Then, you have to send each e-mail activity manually.
This article published on Microsoft on 06 June 2007.
For more information visit:
http://support.microsoft.com/kb/911520/en-us
When you distribute e-mail activities for a campaign in Microsoft Dynamics CRM, the e-mail activities are not automatically sent to the recipients. Instead, you have to open each e-mail activity. Then, you have to send each e-mail activity manually.
This article published on Microsoft on 06 June 2007.
For more information visit:
http://support.microsoft.com/kb/911520/en-us
Posted by
Dynamics 365 Solution Architect | Azure / ALM/DevOps | Power Platform
at
6:56 AM
No comments:
Labels:
Email
Subscribe to:
Posts (Atom)