Skip to content

[Bug]: External Storage - Document Attachments fails on Purch. Cr. Memo Hdr. due to trailing dot in generated SharePoint folder name #12012

Description

@SteveB0z

Describe the issue

We are testing the integration between:
 

  • External Storage - Document Attachments
  • External File Storage - SharePoint Connector
     
    When attempting to upload a document attachment from a Posted Purchase Credit Memo, the upload fails with the following error:
Image Image

Expected behavior

Before creating folders in SharePoint, the connector should sanitize folder names and remove invalid trailing characters "." (and other character not supported by sharepoint).

For Example "Purch. Cr. Memo Hdr." should became "Purch._Cr._Memo_Hdr"

Steps to reproduce

  1. Configure External File Storage - SharePoint Connector
  2. Configure a valid SharePoint site
  3. Enable external storage for Document Attachments
  4. Open "Posted Purchase Credit Memos" and upload an attachment

Additional context

Business Central 28.5 SaaS
External Storage - Document Attachments
External File Storage - SharePoint Connector
No legacy API

I will provide a fix for a bug

  • I will provide a fix for a bug

Suggested fix

codeunit 8751 "DA External Storage Impl." implements "File Scenario"

Current code:

 local procedure GetTableNameFolder(TableID: Integer): Text[100]
    var
        TableName: Text;
    begin
        // Try to get table name from metadata, fallback to table ID if not available
        if not TryGetTableName(TableID, TableName) then
            TableName := 'Table_' + Format(TableID);

        // Replace invalid characters for folder names
        TableName := DelChr(TableName, '=', '<>:"/\|?*');
        TableName := ConvertStr(TableName, ' ', '_');

        exit(CopyStr(TableName, 1, 100));
    end;

New code:

procedure GetTableNameFolder(TableID: Integer): Text[100]
 var
     TableName: Text;
 begin
     // Try to get table name from metadata, fallback to table ID if not available
     if not TryGetTableName(TableID, TableName) then
         TableName := 'Table_' + Format(TableID);

     // Replace invalid characters for folder names
     TableName := DelChr(TableName, '=', '<>:"/\|?*');
     TableName := ConvertStr(TableName, ' ', '_');
     **TableName := DelChr(TableName, '>', '. ');**

     exit(CopyStr(TableName, 1, 100));
 end;

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Team: SCMGitHub request for SCM area

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions