web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Serialization in X++

(0) ShareShare
ReportReport
Posted on by

Hello,

In AX 2009, I've added a reference (PIESClass) to a .NET class (PIESFile) which has namespace PIES.  I'm now using this reference to build an XML document which I'd like to serialize to a file.  But I'm not finding the right way to do this.  I'm trying this kind of thing:

System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(PIESClass.PIES));
 Error: The table does not contain this field.

System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(PIESClass));
Error: Variable PIESClass has not been declared 

I've found quite a bit of info online about serializing, but nothing that tells me exactly what "typeof" is looking for.  Help, please?

Thanks!
Carolee 

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    Please follow following link for more details related to your scenarion

    technet.microsoft.com/.../aa856184.aspx

    this information explains how we have do XML serialization in Dynamics AX

    Please verify and let me know if this information helps you

  • Community Member Profile Picture
    on at

    Thank you, Nitesh, but I don't think is quite what I need. I'm not using the AIF but System.Xml.Serialization.XmlSerializer.

  • Verified answer
    Martin Dráb Profile Picture
    237,924 Most Valuable Professional on at

    Your code would work as C# (if you used a correct type name), but not in X++. typeOf() in X++ is something completely different than typeOf() in C# and it won't return System.Type required by XmlSerializer.

    If you have an instance of PIES.PIESFile, call its GetType() method. If you can't get an instance, get the type by System.Type::GetType().

  • Community Member Profile Picture
    on at

    YYYYYYEAH!  Thanks very much, Martin!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans