Copied to clipboard

Flag this post as spam?

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


  • Marc-André 63 posts 278 karma points
    Nov 20, 2019 @ 18:32
    Marc-André
    0

    ContentService SetValue of Repeatable Strings

    Hello!

    I'm programming a importator with the ContentService and I'm stuck with two type of fields : Repeatable Strings and MultiUrl.

    Before setting my value using the SetValue methods, I check how to format my data with the GetValue method from a test page.

    When my field is one of the types above it always retuns me null.

    When I do page.Properties.ElementAt(xx).Values I got the expected values, but I can't figure out how to set the value.

    Can anybody help me?

    P.S: I hope that my english is not too bad for you to understand my issue hahaha.

  • Dee 114 posts 334 karma points
    Feb 23, 2020 @ 12:33
    Dee
    100

    I just managed to solve this by a very ugly solution:

    SetValue("propertyAlias", "value1\r\nvalue2");

  • Marc-André 63 posts 278 karma points
    Feb 24, 2020 @ 13:58
    Marc-André
    0

    Yes Dee, I solved this the same way :P

  • Paulius Putna 87 posts 165 karma points
    Feb 04, 2021 @ 08:03
    Paulius Putna
    0

    You can user the string.Join() method instead.

    var listOfValues = new List<string>();    
    
    contentService.SetValue("", string.Join(Environment.NewLine, listOfValues));
    
Please Sign in or register to post replies

Write your reply to:

Draft