Microsoft Dynamics 365 Blog

This post describes how you can automate importing and exporting of Microsoft Dynamics NAV objects with C/Front.

To make a basic C/Front project, see the post Beginners guide: How connect to NAV from a .net project, using C/Front. This post only describes the additional code needed to import or export NAV objects.

Exporting objects:

The line below will export Tables 1..10 to the file “C:\x\ExportFob.fob”:



The filter has to be in the same syntax as used in the “DataItemTableView” in a report. The simplest way to create the filter is to make a new report in NAV, based on the Object Table. Then in the DataItem Properties, specify a filter in DataItemTableView, and copy that into your C/Front code.

The file that you export is a normal .fob file, which can be imported back in the usual way (File -> Import from Object Designer), or via C/Front as described next.

Importing objects:

C/Front has a special datatype “NavisionImportMode” to control the actions when the objects you import conflict with existing objects. The possible settings are Overwrite, Skip and ThrowError. The code needed to re-import the object we exported before, is:

NavisionImportMode ImportMode;

ImportMode = NavisionImportMode.Overwrite;




You can only export objects as binary .fob files. It is not possible to export objects as text.

In SP1 for NAV version 5, C/Front will no longer check for license permissions when importing files. So the import-functionality works just like importing objects manually, which means that the license file is not checked. In previous versions it was not possible to import new objects or tables with new fields unless the NAV license would allow the user to create those objects or fields manually.

Lars Lohndorf-Larsen (Lohndorf)
Microsoft Dynamics UK

We're always looking for feedback and would like to hear from you. Please head to the Dynamics 365 Community to start a discussion, ask questions, and tell us what you think!