Here's a sample to export a model. The code is pretty straightforward, I just pass in the name of the DB, the path where to export the file and some other params, and then I get my model saved/imported/moved/deleted.
Here you can find the project for the tool, this will work on every client (you don't need to be on the AOS to export/import models)
private void exportModel(SysModelManifest _SysModelManifest, filePath path) { Microsoft.Dynamics.AX.Framework.Tools.ModelManagement.AxUtil axutil = new Microsoft.Dynamics.AX.Framework.Tools.ModelManagement.AxUtil(); Microsoft.Dynamics.AX.Framework.Tools.ModelManagement.AxUtilContext context = new Microsoft.Dynamics.AX.Framework.Tools.ModelManagement.AxUtilContext(); Microsoft.Dynamics.AX.Framework.Tools.ModelManagement.AxUtilConfiguration config = new Microsoft.Dynamics.AX.Framework.Tools.ModelManagement.AxUtilConfiguration(); Microsoft.Dynamics.AX.Framework.Tools.ModelManagement.ModelArgument modelArgument; int modelId = _SysModelManifest.Model; int i; Object ret; ClrObject o; // = new ClrObject("System.Collections.Generic.List`1[System.String]"); ClrObject enumerator; boolean hasErrors; try { modelArgument = new Microsoft.Dynamics.AX.Framework.Tools.ModelManagement.ModelArgument(modelId); config.set_ExportFile(path + _SysModelManifest.Name); config.set_ModelArgument(modelArgument); config.set_Database(SysSQLSystemInfo::construct().getloginDatabase()); config.set_Server(SysSQLSystemInfo::construct().getLoginServer()); axutil.Export(context, config); o = context.get_Errors(); enumerator = o.GetEnumerator(); while (enumerator.MoveNext()) { error(enumerator.get_Current()); } o = context.get_Warnings(); enumerator = o.GetEnumerator(); while (enumerator.MoveNext()) { warning(enumerator.get_Current()); } hasErrors = context.get_HasError(); if(!hasErrors) info(strFmt("Esportato modello %1 nel file %2" , _SysModelManifest.Name, path + _SysModelManifest.Name)); } catch ( Exception::CLRError ) { error(AifUtil::getClrErrorMessage()); throw Exception::Error; } }