Skip to content

Bug: SharePoint Synchronization flow passes full URL instead of file name to x-ms-file-name causing truncation error #810

Description

@Andraszao

Description

Dataverse File Name Truncation Error

In the child flow Sharepoint Synchronization | Synchronize files to Agent (Child), the file upload actions pass full SharePoint web URLs/paths to the Dataverse parameter x-ms-file-name instead of just the isolated file name.

Because Dataverse enforces a hard 255-character limit on the underlying FileAttachmentBase.FileName column, any document with a long SharePoint path or URL fails with a 400 Bad Request / 0x80090429 truncation error.

Flow & Component

  • Solution: Copilot Studio Kit (CopilotStudioAccelerator)
  • Flow Name: Sharepoint Synchronization | Synchronize files to Agent (Child)
  • Actions Affected:
    1. Upload_a_file
    2. Upload_page_as_file

Root Cause Details

Upload_a_file action

  • Current Mapping:
    "x-ms-file-name": "@items('Apply_to_each_file')?['{Link}']"
    
  • Issue: {Link} passes the full web URL (e.g. https://tenant.sharepoint.com/sites/.../file.docx?d=...), which frequently exceeds 255 characters.
  • Expected Mapping:
    @items('Apply_to_each_file')?['{FilenameWithExtension}']
    

Upload_page_as_file action

  • Current Mapping:
    "x-ms-file-name": "@{items('Apply_to_each_File_Indexer_Configurations')?['cat_siteaddress']}/SitePages/@{items('Apply_to_each_page')?['FileLeafRef']}"
    
  • Issue: Prepends the full site path to the page leaf reference.
  • Expected Mapping:
    @items('Apply_to_each_page')?['FileLeafRef']
    

Error Response

{
  "error": {
    "code": "0x80090429",
    "message": "String or binary data would be truncated..."
  }
}

Suggested Fix

Update the managed flow definition so that both Upload_a_file and Upload_page_as_file map x-ms-file-name exclusively to file names ({FilenameWithExtension} / FileLeafRef) rather than full URLs or site paths.

Steps to reproduce

Steps

  1. Configure SharePoint Synchronization for a document library where full file links exceed 255 characters.
  2. Trigger the sync process via Sharepoint Synchronization | On Demand.
  3. Inspect the child flow run under Upload_files_to_Copilot_Studio > Upload_a_file.
  4. Observe the flow failure on the Dataverse file upload step with error 0x80090429.

Expected behavior

Child flow runs successfully for file sync

Actual behavior

Flow fails to finish syncing files

Environment

No response

Additional context or logs

No response

Metadata

Metadata

Labels

bugSomething isn't working

Type

Projects

Status
Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions