Copied to clipboard

Flag this post as spam?

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


  • Joseph May 11 posts 104 karma points
    Jun 26, 2020 @ 13:47
    Joseph May
    0

    Populate a repeatable textstring via headless client

    Hello,

    I am attempting to create a new content item and populate a repeatable textfield called "urlSegments" on the item.

    For example:

            // using ManagementContent = Umbraco.Headless.Client.Net.Management.Models.Content;
    
            var item = new ManagementContent
            {
                ParentId = ItemIds.BrandSettings,
                ContentTypeAlias = ContentTypeAliases.Brand
            };
    
            item.Name.Add(Culture, request.BrandName);
            item.Properties.Add("urlSegments", new Dictionary<string, object>
            {
                {Culture, string.Join('\r', request.BrandUrlSegments)}
            });
    

    Although this successfully creates the item, the urlSegments field is blank in the backoffice.

    This example uses a '\r' delimiter based on these threads:

    https://our.umbraco.com/forum/using-umbraco-and-getting-started/100082-contentservice-setvalue-of-repeatable-strings

    https://our.umbraco.com/forum/extending-umbraco-and-using-the-api/77014-create-extra-textstring-in-repeatable-texstring-programmatically

    I have also tried just dropping a List

    Any ideas?

    Thanks, Joe

  • 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