Upload multiple pictures from folder to BC16 webclient without dialog

dep_cornatordep_cornator Member Posts: 3
edited 2020-05-19 in NAV Three Tier
Hi,

I want to upload multiple pictures from a folder to the BC16 webclient (OnPrem) without a dialog. Therefore I can't use UPLOADINTOSTREAM function and using the file management codeunit is not allowed in an extension.

Is there a possible workaround (SQL query, PowerShell, Webservice)?

Best Answer

  • ftorneroftornero Member Posts: 522
    Answer ✓
    Hello @dep_cornator ,

    You can use something like that:
            DirectoryPath := 'C:\run';
            fileMgt.GetServerDirectoryFilesListInclSubDirs(TempNameValueBuffer, DirectoryPath);
            if TempNameValueBuffer.FindSet() then
                repeat
                    if fileMgt.GetFileName(TempNameValueBuffer.Name) = 'start.ps1' then begin
                        fileMgt.BLOBImportFromServerFile(TempBlob, TempNameValueBuffer.Name);
                        if TempBlob.HasValue() then begin
                            TempBlob.CreateInStream(InStr);
                            InStr.ReadText(qTexto);
                        end;
                        exit;
                    end;
                until TempNameValueBuffer.Next() = 0;
    

    But the paths and files must be in the server, you don't have access to the client file system, later on with the InStream you can do whatever you want.

    Regards

Answers

  • ftorneroftornero Member Posts: 522
    Hello @dep_cornator ,

    If your app target is "OnPrem"

    d9n6raqdy8lj.png


    You can use the file management codeunit.

    Regards.
  • dep_cornatordep_cornator Member Posts: 3
    edited 2020-05-19
    dcyzxjx5ba26.png
    How @ftornero? It's not allowed to use UploadFileSilent in a BC16 extension?

    Message in Dutch saying 'This action is not available for the online version of the app.'
  • ftorneroftornero Member Posts: 522
    Answer ✓
    Hello @dep_cornator ,

    You can use something like that:
            DirectoryPath := 'C:\run';
            fileMgt.GetServerDirectoryFilesListInclSubDirs(TempNameValueBuffer, DirectoryPath);
            if TempNameValueBuffer.FindSet() then
                repeat
                    if fileMgt.GetFileName(TempNameValueBuffer.Name) = 'start.ps1' then begin
                        fileMgt.BLOBImportFromServerFile(TempBlob, TempNameValueBuffer.Name);
                        if TempBlob.HasValue() then begin
                            TempBlob.CreateInStream(InStr);
                            InStr.ReadText(qTexto);
                        end;
                        exit;
                    end;
                until TempNameValueBuffer.Next() = 0;
    

    But the paths and files must be in the server, you don't have access to the client file system, later on with the InStream you can do whatever you want.

    Regards
  • dep_cornatordep_cornator Member Posts: 3
    Ok, thx... go try it
Sign In or Register to comment.