microsoft / microsoft/Power-CAT-Copilot-Studio-Kit

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

Open
#810 0 comments 0 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
450
Forks
95
Avg merge
26m
Merged PRs (30d)
5

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.