public void CreateEmailActivity(string accountId, string PDFFileNameName, string invoiceId)
{
string[] splitName = PDFFileNameName.Split('-'); //Larry & Susan Craven - Invoice Processed For Month - Jan 2009.pdf
string[] splitExt = splitName[2].Split('.');
service = CLM_CRM_Service.GetCrmService();
email actpointer = new email();
actpointer.subject = "Christian Life Ministry - " + splitName[1].ToString() + " - " + splitExt[0].ToString();
actpointer.description = "body";
Guid ow = new Guid(ownerID.ToString());
actpointer.ownerid = new Owner();
actpointer.ownerid.type = EntityName.systemuser.ToString();
actpointer.ownerid.Value = ow;
activityparty party = new activityparty();
party.partyid = new Lookup();
party.partyid.type = EntityName.systemuser.ToString();
party.partyid.Value = ow;
actpointer.from = new activityparty[] { party };
Guid ow1 = new Guid(accountId.ToString());
activityparty party1 = new activityparty();
party1.partyid = new Lookup();
party1.partyid.type = EntityName.account.ToString();
party1.partyid.Value = ow1;
actpointer.to = new activityparty[] { party1 };
Guid ow2 = new Guid(invoiceId.ToString());
Lookup lookup = new Lookup();
lookup.Value = ow2;
lookup.type = EntityName.invoice.ToString();
actpointer.regardingobjectid = lookup;
Guid emailActId = service.Create(actpointer);
AddAttachmentToEmailActivity(emailActId.ToString(), PDFFileNameName);
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment