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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Business Central forum

Create folder

(0) ShareShare
ReportReport
Posted on by 449

Hello Everyone,

I need to create a new folder on ftp/Local path. How can i achieve this in D365BC.

Thanks in advance.

Categories:
  • Suggested answer
    Stefano Demiliani Profile Picture
    37,172 Most Valuable Professional on at

    Not possible natively (you can't access file system in the cliud environment). Obviously if you're on-premise you can do that exactky like in NAV.

  • Manish Ratan Profile Picture
    449 on at

    Is there any work around? Can we create new folder on FTP using javascript.

    Thanks.

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,172 Most Valuable Professional on at

    Yes you need a workaround, for example a JS addin, azure function or a call to an external WS that does that.

  • Manish Ratan Profile Picture
    449 on at

    Thanks for the reply, Will look into it and will update soon.

  • Manish Ratan Profile Picture
    449 on at

    Hi,

    Please send me some more details related to azure function, to create folder.

    Thanks.

  • Manish Ratan Profile Picture
    449 on at

    Hi ,

    In came across to create Folder, node javascript will be required. Need to know, can we use node javascript addin in D365BC?

    Thanks

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,172 Most Valuable Professional on at

    Yes you can.

    Regarding the Azure Function, I don't have aready to go sample now, but from an Azure Function you can create a local file and then download it to the client.

    To create a local file from an Azure Function, this is a quick sample:

    using System;

    using System.IO;

    public static void Run(TimerInfo myTimer, TraceWriter log)

    {

       log.Info($"C# Timer trigger function executed at: {DateTime.Now}");

       var filePath = Path.Combine(Environment.ExpandEnvironmentVariables("%HOME%"), @"site\wwwroot", "testfile.txt");

       File.WriteAllText(filePath, $"Writing to file at {DateTime.Now}.");

       var read = File.ReadAllText(filePath);

       log.Info($"Read from file: {read}");

    }

    Note that the file is created on Azure local function storage. It mst then be pushed to the client.

  • Manish Ratan Profile Picture
    449 on at

    Thanks for reply :)

  • Manish Ratan Profile Picture
    449 on at

    I have created the below node javascript. But when calling this script, getting error in D365BC "Cannot read property 'existsSync' of undefined".

    File Name : ServerScript.js

    var fs = require('fs');

    function createDir(path)

    {

      if (!fs.existsSync(path))

     {      

           fs.mkdirSync(path);

      }

    }

    Please let me know, what am i missing.

    Thanks.

  • Manish Ratan Profile Picture
    449 on at

    Thanks, through WS was able to create folder on FTP

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Business Central

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans