Previously, we had gone through a blog on Viewing the Object Details of Business Central Extensions. Now, let’s explore to export the Extension details, generally the information available in the app.json of the extension created using Windows Powershell into formats like Html or Excel format.
In order to export the extension details, let’s go to Windows Powershell (Run as administrator). In this process, we will be importing the Business Central Powershell script NAVAdminTool.
Firstly, we will go through the steps to export the details into HTML page. The following code converts the information into Html page and saves it in the path mentioned in the script itself.
$Header = @"
<style>
TABLE {border-width: 1px; border-style: solid; border-color: black; border-collapse: collapse;}
TH {border-width: 1px; padding: 3px; border-style: solid; border-color: black; background-color: #6495ED;}
TD {border-width: 1px; padding: 3px; border-style: solid; border-color: black;}
</style>
"@
Import-Module "C:Program FilesMicrosoft Dynamics 365 Business Central150ServiceNavAdminTool.ps1"
Write-Output 'Business Central Extension Management Details'
$ServerInstance = 'BC150'
Get-NAVAppInfo -ServerInstance $ServerInstance -Name $ServerInstance
$string = Get-NAVAppInfo
$string | Get-NAVAppInfo | ConvertTo-Html -Property ID,Name,Version,Publisher,ExtensionType,Scope,Brief,Description,Dependencies,PackageID -Head $Header | Out-File D:PowerShellProcess16.html
Now, Run Script (F5) and check the Output path mentioned in the script (Out-File). The File will be generated.
We can see the html page opened in the browser displaying details including Version and Package ID.
Let’s approach Excel output generation as follows:
Import-Module "C:Program FilesMicrosoft Dynamics 365 Business Central150ServiceNavAdminTool.ps1"
$string = Get-NAVAppInfo
$string | Get-NAVAppInfo |
Select-Object ServerInstance, Name, Publisher, Scope, AppID, PackageID, Brief, Description, DeveloperTenantId, Dependencies |
Export-Csv -Path D:PowerShelloutput1125.csv
This approach is to provide assistance on exporting all the details related to overall extensions published in an instance at one go.