Simple metadata query in Powershell (D365FO)

If I need to extra metadata of a D365FO application, my preferred way is the new metadata API. But sometimes the requirement is so simple that it’s sufficient to query source XML files directly.

For example, this all what’s needed to get a list of fields from a table (together with their types) and store it in a CSV file. It’s written in Powershell:

[xml]$xml = Get-Content $inputXmlFilePath
$xml.AxTable.Fields.AxTableField | select Name, ExtendedDataType, EnumType | Export-CSV $outputCsvFilePath -nti

It’s great for trivial cases like this. If I needed more details about fields or I had to take into account table extensions, for example, then the metadata API would be a better choice.

Comment List
Related
Recommended