0
我有一个需求,我需要将文档从SharePoint添加到Dynamics CRM Workflow中,并在其中发送电子邮件。将文档从SharePoint添加到Dynamics CRM工作流程的电子邮件
这是可以实现的吗?另外,是否有任何解决方法可以完成此项工作? 请提醒。谢谢!
我有一个需求,我需要将文档从SharePoint添加到Dynamics CRM Workflow中,并在其中发送电子邮件。将文档从SharePoint添加到Dynamics CRM工作流程的电子邮件
这是可以实现的吗?另外,是否有任何解决方法可以完成此项工作? 请提醒。谢谢!
您试图实现的功能不可能是现成的,但您可以做的是创建一个自定义工作流活动并以编程方式从SharePoint读取文件并将该字节数组作为base64字符串写入活动主体,创建一封电子邮件并将该文件作为附件附加到电子邮件并发送出去。
var email = new Email
{
Subject = "Email with attachment from SharePoint.",
Description = "Find the document attached.",
From =
new[]
{
new ActivityParty() { PartyId = new CrmEntityReference(SystemUser.EntityLogicalName, fromUserGuid) }
},
To =
new[]
{
new ActivityParty() { PartyId = new CrmEntityReference(SystemUser.EntityLogicalName, toUserGuid) }
},
DirectionCode = true
};
var emailId = organizationService.Create(email);
var sampleAttachment = new ActivityMimeAttachment()
{
ObjectId = new CrmEntityReference(Email.EntityLogicalName, emailId),
ObjectTypeCode = Email.EntityLogicalName,
Subject = "File attached from sharepoint",
Body = Convert.ToBase64String(new byte[] { }), //replace the bytes with the file bytes read from SharePoint
FileName = "sharepointattachment.txt"
};
organizationService.Create(sampleAttachment);
var sendEmailMessageRequest = new SendEmailRequest() { EmailId = emailId, IssueSend = true };
var sendEmailResponse = (SendEmailResponse)organizationService.Execute(sendEmailMessageRequest);
非常感谢!如果这对我有用,我会让你知道.. :) – priyeshwagh777