Skip to main content

Notifications

Announcements

No record found.

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 13
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?
  • Verified answer
    PaulJ94 Profile Picture
    PaulJ94 13 on at
    AFS File Client
    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;
  • Bilal Haider Profile Picture
    Bilal Haider 232 on at
    AFS File Client
    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

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,436 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans