X++ Code to Export AOT Object / automatic backup of XPO's.


Hi friends, hope all is well!! J

Today am here to convey the most vital subject for MS dynamics AX.

Development or customization's are the most important topic which should be saved or backup need to be taken on daily or weekly basis.

We need to take daily backup of our development (in terms of XPO), but we all always forget because of our hectic work schedules.

So use the following job and build batch application to take backup of development in terms of XPO.
We can take AOD file also but the size will be more and needs to stop AOS every time.

Following job illustrates how to export/backup all AOT Classes object.

void ExportTreeNodeExample()
{
    TreeNode            treeNode;
    FileIoPermission    perm;

    #define.ExportFile(@"D:\AOTclasses.xpo")
    #define.ExportMode("w")
    ;

    perm = new FileIoPermission(#ExportFile, #ExportMode);
    if (perm == null)
    {
    return;
    }
    perm.assert();

    treeNode = TreeNode::findNode(@"\Classes");
    if (treeNode != null)
    {

    // BP deviation documented.
    treeNode.treeNodeExport(#ExportFile);
    }

    CodeAccessPermission::revertAssert();

}

Keep reading!! J

10 comments:

  1. Check this file
    https://www.box.com/s/khmpb1u4x8ydt9sj7iie

    It's made for Dax 2012 . I export all xpos into a folder and search there after this

    ReplyDelete
    Replies
    1. hi adiso,
      Thanks for sharing the XPO related to DAX2012.

      Delete
  2. thanks, but how can I import object to AOT by code, please?

    ReplyDelete
    Replies
    1. Use standard class SysImportElements to get this. Just a simple example:

      SysImportElements sysImportElements = new SysImportElements();

      sysImportElements.newFile("D:\\testing.xpo");
      sysImportElements.parmImportAot(true);
      sysImportElements.parmImportWithIds(false);
      sysImportElements.import();

      Delete
  3. Hello Vishal thanks for that codes, but if i want to backup specified name only how is it gonna be?

    *example i want to backup jobs started with name like EU_JBS* ....

    ReplyDelete
  4. This blog is so nice to me. I will keep on coming here again and again. Visit my link as well.. Microsoft Dynamics 365 Business Central Credit Card Processing

    ReplyDelete
  5. I seriously take pleasure in this specific amazing article that you've furnished for individuals. My spouse and i promise this may always be therapeutic for the majority. [pii_email_8079047078567379049d]

    ReplyDelete
  6. I was just browsing through the internet looking for some information and came across your blog. I am impressed by the information that you have on this blog. It shows how well you understand this subject. Bookmarked this page, will come back for more. Windows

    ReplyDelete
  7. Really appreciate this wonderful post that you have provided for us.Great site and a great topic as well i really get amazed to read this. Its really good. wazirx referral code

    ReplyDelete
  8. After i truly motivate you to definitely realize that term it happens to be pleasure recognized... puzdro samsung

    ReplyDelete

Powered by Blogger.