cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
colbournescott
Level: Powered On

Dynamics 365 - Use flow to take an attachment from an email on an opportunity and place it in the specified Sharepoint Location for the Opportunity?

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.

2 REPLIES 2
Community Support Team
Community Support Team

Re: Dynamics 365 - Use flow to take an attachment from an email on an opportunity and place it in the specified Sharepoint Location for the Opportunity?

Hi @colbournescott,

 

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.

https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/webapi/associate-disassocia...

2. Or you can store attachments into the SharePoint list, then create the association between the opportunity entity and SharePoint list.

Best Regards,
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.

Super User
Super User

Re: Dynamics 365 - Use flow to take an attachment from an email on an opportunity and place it in the specified Sharepoint Location for the Opportunity?

Hi @colbournescott 

 

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.


Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!


Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (5,271)