简体   繁体   English

用于在CRM 2011中的电子邮件实体的“创建”插件上获取电子邮件附件的插件

[英]Plugin to fetch the Email Attachment on “Create” plugin of Email Entity in CRM 2011

On creation of Email entity i am triggering a plugin. 创建电子邮件实体时,我正在触发插件。

Primary Entity: email Message: Create Execution Mode: Synchronous Pipeline: POST-operation(MSCRM 2011 only) 主实体:电子邮件消息:创建执行模式:同步管道:POST操作(仅MSCRM 2011)

I have two problems: 我有两个问题:

  1. Problem 1: 问题一:

In that plugin, i want to access the attachments of the email. 在该插件中,我想访问电子邮件的附件。 When i try to access the activitymimeattachement by passing the activityid of that email, it returns zero attachments, whereas there are 4-5 attachments present in the email. 当我尝试通过传递电子邮件的activityid来访问activitymimeattachement时,它将返回零附件,而电子邮件中存在4-5个附件。

  1. Problem 2: 问题2:

Also update the regarding field of that created email with the id of a case record that i created on that plugin. 还要用我在该插件上创建的案例记录的ID更新该已创建电子邮件的About字段。

Please help. 请帮忙。

Problem 1. I'm not sure, but I think attachments will be created AFTER email was created. 问题1.我不确定,但是我认为在创建电子邮件之后会创建附件。 It means that when the plugin fires, attachment still not created. 这意味着当插件触发时,附件仍未创建。 To work with attachments I can suggest create another plugin especially for activitymimeattachement entity. 要使用附件,我建议您创建另一个插件,尤其是针对activitymimeattachement实体。 Problem 2. It's actually not completely clear what is the problem, but I think what you are interested in here, it is that you should retrieve recently created email entity instance, update it's properties and save again, or make your plug in PRE STAGE plugin. 问题2:实际上并不能完全弄清楚问题出在哪里,但是我认为您对此感兴趣,那就是您应该检索最近创建的电子邮件实体实例,更新其属性并再次保存,或者将其插入PRE STAGE插件。

I am agree with @paramosh's answer. 我同意@paramosh的回答。 If you post your code that will help us to answer better. 如果您发布代码,将有助于我们更好地回答。

Here is the example how you can update regarding field: 这是您可以如何更新字段的示例:

Email.Attributes["regardingobjectid"] = new EntityReference("contact", contact.Id);

I hope it will help to sort out your Problem 2. 希望对您解决问题2有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM