I am trying to trigger a flow when an email record is created. I use a condition that it is regarding an opportunity.
Then I want to get the attachment from the email and put it in the Opportunity's Sharepoint file location.
1. I have seen solutions stating "get attachment" but I do not see this flow option with Dynamics 365. Can I use the "attachment" entity?
2. How do I find the Sharepoint location regarding the opportunity?
Thanks in advance community.
1. You can get the attachments from the email, then store them into the attachment entity, then you can create the association between the opportunity entity and attachment entity.
2. Or you can store attachments into the SharePoint list, then create the association between the opportunity entity and SharePoint list.
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
1. Use the CDS connector to get the Attachment record associated with the email. You can find this by querying the activitymimeattachments entity where the objectid is equal to the guid of the Email record. Then use the base64ToBinary function in Flow to convert the body property of the attachment record, the output of which you can use in step 2 below.
2. The SharePoint location for each record should be available by querying the Document Location (sharepointdocumentlocations) entity where the regardingobjectid is the guid of the Opportunity record. Once you have the Document Location associated with the Opportunity record you can use the SharePoint connector to create the file in SharePoint, using the Relative URL field from the Document Location. The filecontent property in the Create File in SharePoint action should be set to the value you generated in step 1 above using the base64ToBinary function.
The file should then be visible in the Documents tab of the Opportunity within Dynamics 365 and safely stored in SharePoint. One thing to look out for when querying the Document Locations is that they won't exist if the Documents tab has never been viewed on the record in Dynamics. If this is the case you just need to add some additional steps to create this. I have used this article to achieve something similar using Note attachments (https://community.dynamics.com/365/customerservice/b/futurezconsulting365ce/posts/flow-examples-note...).
Hope that helps point you in the right direction.
I also found a blog post about "Move Attachments from Tracked Email to SharePoint using Microsoft Flow". Even though the blog post was written before CDS connector is available, it should work with CDS connector too.
Check out the new Process Advisor community forum board!
Check out new user group experience and if you are a leader please create your group
Participate in the Power Virtual Agents Community Challenge
Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.