Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

Is there a way that I can Save file in a specific folder dynamically

Posted on by 41

I would like to save a file in a specific folder, I used the function

DOWNLOADFROMSTREAM 

But can I make it work without a show popup to the user, making it in the background in a specific folder?

TempFile.CREATEINSTREAM(NewStream);
ToFileName := 'SampleFile.txt';
DOWNLOADFROMSTREAM(NewStream,’ Export’,'', ’ All Files (*.*)|*.*’,ToFileName)

And besides that can I create a Folder with AL

I made some search and I just found that I can only make zipFolder with  

Codeunit "Data Compression"
But this codeunit doesn't exist in older version is there any equivalent for it?
  • TAHER El Mehdi Profile Picture
    TAHER El Mehdi 41 on at
    RE: Is there a way that I can Save file in a specific folder dynamically

    Yes, Inge is right!

    I am not saving file Report to use method SaveAsPdf, I want to save file txt for example in local machine where BC server running or create a folder! is that possible?

  • TAHER El Mehdi Profile Picture
    TAHER El Mehdi 41 on at
    RE: Is there a way that I can Save file in a specific folder dynamically

    Yes I do this on-prem, what's some possibilities I have to save in a specific folder, and is it even possible to create a folder?

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 73,647 Super User 2024 Season 2 on at
    RE: Is there a way that I can Save file in a specific folder dynamically

    Hi, Inge is right, if you're On-Pre you can do this as in NAV. But it can't be done for the SaaS version. Because the SaaS server can't find your local folder.

    Take another example:

    Report.SaveAsPdf is supported only in Business Central on-premises.

     pastedimage1660868074078v1.png

    pastedimage1660868083441v2.png

    Hope this helps as well.

    Thanks.

    ZHU

  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 32,748 Super User 2024 Season 1 on at
    RE: Is there a way that I can Save file in a specific folder dynamically

    If you are running BC online you can not decide the file location through AL code. Unless you want to save to Azure blob storage or OneDrive.

    Because the background services have no connection to your client machines / servers.

    If you are onprem you still have some possibilities.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans