You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过Microsoft Flow更新Dynamics 365邮件活动指向SharePoint 2013 on-prem附件?

Here's a practical, step-by-step guide to modify your existing Flow so it updates the Dynamics 365 Email activity with direct links to the uploaded SharePoint attachments:

First, create a dedicated field to store SharePoint links (this keeps your original email content intact and organizes the links neatly):

  • Go to Advanced Settings > Customizations > Customize the System
  • Navigate to Entities > Email > Fields > New
  • Choose Multiple Lines of Text (ideal for multiple attachments) or Single Line of Text (for single files)
  • Name it something like new_SharePointAttachmentLinks, then save and publish the changes

2. Modify Your Existing Flow

Assuming your current Flow already triggers on email activities and uploads attachments to SharePoint 2013 via the on-prem gateway, add these steps after the file upload process:

Step A: Initialize an Array Variable (For Multiple Attachments)

  • Add an Initialize variable action at the start of your Flow
  • Set Name to attachmentLinks, Type to Array (this will collect links for all uploaded files)

Wrap your existing "Upload to SharePoint" action in an Apply to each loop (targeting the attachments from the email record):

  1. Right after the Create file action (which uploads to SharePoint), add an Append to array variable action
  2. For the Value, build the full SharePoint file URL using this formula (replace the placeholder site URL with your actual SharePoint 2013 address):
    @concat('http://your-sharepoint-site-url/', outputs('Create_file')?['body/Path'], outputs('Create_file')?['body/Name'])
    
    This combines your SharePoint site URL, the file's path in the library, and the filename to create a direct access link.

Step C: Update the Dynamics 365 Email Record

Add an Update a record action (targeting the Dynamics 365 Email entity):

  • Select the email record ID from your trigger (e.g., @{triggerBody()?['emailid']})
  • In your custom field (new_SharePointAttachmentLinks), set the value to:
    • For single attachments: @{variables('attachmentLinks')[0]}
    • For multiple attachments: @{join(variables('attachmentLinks'), '\n- ')} (this formats links as a bulleted list)
  • Optional: If you want to embed links directly in the email body, update the Description field with:
    @{triggerBody()?['description']}
    
    ---
    SharePoint Attachment Links:
    @{join(variables('attachmentLinks'), '\n- ')}
    

3. Key Checks & Troubleshooting

  • Permissions: Make sure the Flow's service account has:
    • Write access to the Dynamics 365 Email entity
    • Edit permissions on the target SharePoint 2013 library
  • On-Prem Gateway: Confirm the gateway is online and configured to connect both Dynamics 365 CE and your SharePoint 2013 environment
  • Link Validation: Test the generated URL to ensure it opens the correct file in SharePoint—adjust the concat formula if your library uses nested folders

Testing

Trigger the Flow by creating an email activity with attachments in Dynamics 365. Once the Flow runs successfully, open the email record to verify the SharePoint links are populated in your custom field or body.

内容的提问来源于stack exchange,提问作者sainathas

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.09 08:12:42