Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Sébastien Richer 194 posts 430 karma points
    Jun 18, 2012 @ 22:22
    Sébastien Richer
    0

    Programmatically creating embedded content values

    Hello,

    I'm coding a data import and creating my content nodes programmatically. I has this simple data type using the embedded content data type. it has 2 textstring values "Text" and "Telephone", it's a list of phone numbers.

     

    Now I'm getting my nodes like this : 

    var newNode = Document.MakeNew(nom, DocumentType.GetByAlias("SomeCoolType"), User.GetCurrent(), 5481);

    Then I can set normal values :

    newNode.getProperty("adresse").Value = formatedAddress;

    But for embedded content I can't get it to work :

    var listeDeNumerosDeTelephone = "<listeDeNumerosDeTelephone>" +
                                                    "<data>" +
                                                    "<item id=\"1\"" +
                                                    "<texte propertyid=\"1\">Renseignements généraux</texte>" +
                                                    "<telephone propertyid=\"2\">" + tel + "</telephone>" +
                                                    "</item>" +
                                                    "<item id=\"2\"" +
                                                    "<texte propertyid=\"1\">Fax</texte>" +
                                                    "<telephone propertyid=\"2\">" + fax + "</telephone>" +
                                                    "</item>" +
                                                    "</data>" +
                                                    "/<listeDeNumerosDeTelephone>";
    
                    newNode.getProperty("listeDeNumerosDeTelephone").Value = listeDeNumerosDeTelephone;

     

    Has anyone done this before?

    Thanks!

  • Sébastien Richer 194 posts 430 karma points
    Jun 18, 2012 @ 22:33
    Sébastien Richer
    0

    I've tried with "<listeDeNumerosDeTelephone" and without.

  • Sébastien Richer 194 posts 430 karma points
    Jun 19, 2012 @ 20:47
    Sébastien Richer
    0

    Ok, I only had to close my item tag... nice typo seb :)

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies