简体   繁体   中英

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)

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.

  1. Problem 2:

Also update the regarding field of that created email with the id of a case record that i created on that plugin.

Please help.

Problem 1. I'm not sure, but I think attachments will be created AFTER email was created. 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. 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.

I am agree with @paramosh's answer. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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