web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

AFS File Client

(0) ShareShare
ReportReport
Posted on by 51
Hi, I am trying use the AFS File Client to Copy a File from one folder into another folder in the same File Share but keep getting a 500 response. Has anybody been able to use the CopyFile function within the AFS File Client Codeunit?
I have the same question (0)
  • Bilal Haider Profile Picture
    485 on at
    Hi,
     
    Yes I have used Azure File Share inside Business Central and used multiple procedures from AFS File Client codeunit.
     
    Can you share the telemetry as using copyFile function telemetry is always generated. It will be with event ID 0000M34 to 0000M36
  • Verified answer
    PaulJ94 Profile Picture
    51 on at
    So the issue was with using a SAS token. 
     
    When copying a file you need to do the following.
     
    local procedure AuthorizeSourceFile(StorageAccount: Text; FileShareName: Text; var StorageServiceAuthorization: Interface "Storage Service Authorization"; SourcePath: Text): Text
        var
            HttpRequestMessage: HttpRequestMessage;
            SourceFileURILbl: Label 'https://%1.file.core.windows.net/%2/%3', Comment = '%1 = Storage Account, %2 = File Share Name, %3 = Source Path';
            SourceFileURI: Text;
        begin
            SourceFileURI := StrSubstNo(SourceFileURILbl, StorageAccount, FileShareName, SourcePath);
            HttpRequestMessage.SetRequestUri(SourceFileURI);
            StorageServiceAuthorization.Authorize(HttpRequestMessage, StorageAccount);
            exit(HttpRequestMessage.GetRequestUri());
        end;

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,314 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,781 Super User 2026 Season 1

#3
AndrewThomas81 Profile Picture

AndrewThomas81 1,356

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans