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

Notifications

Announcements

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 32
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
    414 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
    32 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

News and Announcements

Season of Giving Solutions is Here!

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,688

#2
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 784 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 595 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans