Service to import files

The task is to import every file that is dropped into a specific folder on my local drive into NAV.  The solution is a windows service programmed in Visual Studio 2008 VB.NET. The first step is to create a web service in Dynamics NAV that...
Continue reading »

Using Common Dialog Cancel button

In the default Codeunit 412 is a function that opens a open or a save dialog.  The problem with this function is that we do not know if the open, save or cancel button was pressed.  I used the code [code htmlscript=”false”]FileName := CommonDialogMgt.OpenFile(”,FileName,1,CommonDialogMgt.GetFilterString(1),1);[/code] where...
Continue reading »

Client Temporary Path

In one of my solutions I create a lot of Excel and PDF documents.  All these documents are stored in BLOB fields and then downloaded to the client computer temporary folder and opened for the user. Every time I use the ClientTempFileName function in Codeunit...
Continue reading »

Reading a text file

To follow up the post about writing a text file with Automation I would also like to post about reading a text file with that same Automation.  Now we add the automation automation ‘Windows Script Host Object Model’.File.  First you need to create a file...
Continue reading »

File download with RTC

My earlier post on File Download used the responsestream property of WinHTTP. On my latest project I needed to use Windows Authentication on my website and found out that I needed to create the WinHTTP automation on client level to login with the current user....
Continue reading »

Unzip Files

By using the Automation “‘Microsoft Shell Controls And Automation’.Shell” you can unzip a file within Dynamics NAV. Create a Global Name DataType Subtype SystemShellControl Automation ‘Microsoft Shell Controls And Automation’.Shell SystemShellItem Automation ‘Microsoft Shell Controls And Automation’.FolderItem SystemShellItems Automation ‘Microsoft Shell Controls And Automation’.FolderItems FileName...
Continue reading »

Download a File

In Dynamic NAV it is possible to use the Automation “‘Microsoft XML, v6.0’.XMLHTTP” to download files.  The code would be [code]IF ISCLEAR(WinHTTP) THEN CREATE(WinHTTP,TRUE,FALSE); WinHTTP.open(‘GET’,URL,FALSE); WinHTTP.send(”); IF WinHTTP.status <> 200 THEN ERROR(Text003,WinHTTP.status,WinHTTP.statusText); TempFile.CREATE(TempFileName); TempFile.CREATEOUTSTREAM(OutStr); InStr := WinHTTP.responseStream; COPYSTREAM(OutStr,InStr); TempFile.CLOSE;[/code] Where Text003 is “Status error %1...
Continue reading »

File Handling and RTC

In the Role Tailored Client all file system commands used by the Classic Client have been removed.  For those who have been using commands such as EXISTS, RENAME and ERASE there is a code update to be done.  I created a codeunit that includes these...
Continue reading »