Import Object (.txt) to Dynamivs NAV 2013

amh1984
Member Posts: 9
Hello !
Someone have an idea how to import an object (text) to Dynamics NAV 2013 by the code C/AL code
For information : the function IMPORTOBJECTS(filename) is not supported by NAV 2013
Thanks
Someone have an idea how to import an object (text) to Dynamics NAV 2013 by the code C/AL code
For information : the function IMPORTOBJECTS(filename) is not supported by NAV 2013
Thanks
0
Comments
-
Hi,
this is only possible via command line parameters in NAV2013.
with best regards
Jens0 -
you were right jglathe,
I created this script ....and launched it by Microsoft Dynamics NAV 2013 Administration Shell
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# Register Snap-in
function Import-NAVApplicationObjectFilesFromFolder
{
[CmdletBinding()]
param (
[String]$SourceFolder,
[String]$LogFolder,
[String]$Database,
[String]$UserName,
[String]$Pwd,
[String]$ServName
)
$UserName = 'Domaine\login'
$Pwd = 'mp'
$ServName = 'AMH-LAPTOP\NAVDEMO'
$NAVFolder = 'C:\Program Files (x86)\Microsoft Dynamics NAV\70\RoleTailored Client'
$importfinsqlcommand = """$NAVFolder\finsql.exe"" command=importobjects,servername=$ServName,ntauthentication=0,username=$UserName,password=$Pwd,database=$Database,file="
$TextFiles = gci "$SourceFolder\*.txt"
foreach ($TextFile in $TextFiles){
$Command = $importfinsqlcommand + $TextFile
write-host $Command
$LogFile = "$LogFolder\$($TextFile.Basename).log"
if ($LogFolder -ne ""){$Command = $Command + ',LogFile=' + "$LogFile"}
Write-Debug $Command
cmd /c $Command
if (Test-Path "$LogFolder\navcommandresult.txt")
{
Write-Verbose "Processed $TextFile ."
Remove-Item "$LogFolder\navcommandresult.txt"
}
else
{
Write-Warning "Crashed when importing $TextFile !"
}
If (Test-Path "$LogFile") {Write-Warning "Error when importing $TextFile"}
}
}
# Welcome message
write-host $Command
write-host "`nWelcome to the Server Admin Tool Shell!"
write-host "For a complete list of Server cmdlets type`n"
write-host -fore Yellow "Get-Command *NAVServer*`n"
# Register Microsoft Dynamics NAV Management Snap-in
Import-NAVApplicationObjectFilesFromFolder "D:\fichiers" "D:\log" "Demo Database NAV (7-0)"
# Print available commands
Get-Command *NAVServer*
But I have this error in log file :
[22922070] The following SQL Server error or errors occurred: 18456,"28000",[Microsoft][SQL Server Native Client 10.0][SQL Server]Login failed for user 'Domaine\login'.0 -
I tested and runned this command line ,and it's not work,I have an error message
([22922070] The following SQL Server error or errors occurred: 18456,"28000",[Microsoft][SQL Server Native Client 10.0][SQL Server]Login failed for user 'Domaine\user'.)
"C:\Program Files (x86)\Microsoft Dynamics NAV\70\RoleTailored Client\finsql.exe" command=importobjects ntauthentication=yes, servername=AMH-LAPTOP\NAVDEMO, database=Demo Database NAV (7-0), company=CRONUS France S.A. , file=D:\fichiers\T27.txt"
but if I test this :
"C:\Program Files (x86)\Microsoft Dynamics NAV\70\RoleTailored Client\finsql.exe" ntauthentication=yes, servername=AMH-LAPTOP\NAVDEMO, database=Demo Database NAV (7-0), company=CRONUS France S.A.
My command line works very well
Someone have an idea why my first command don't work ??0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions