Copied to clipboard

Flag this post as spam?

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


  • Lionys Julio Ruiz Casanova 1 post 71 karma points
    15 days ago
    Lionys Julio Ruiz Casanova
    0

    How to add tags value in tags datatype programmatically in umbraco 9

    How to add tags value in tags datatype programmatically in umbraco 9

    if (articles != null && articles.Any() && blog != null)
                {
                    foreach (var articleItem in articles)
                    {
                        IContent newArticle = _contentService.Create(articleItem.Title, blog.Id, "article");
                        newArticle.SetValue("title", articleItem.Title);
                        newArticle.ParentId = blog.Id;
                        newArticle.SetValue("subTitle", articleItem.SubTitle);
                        newArticle.SetValue("shortSubTitle", articleItem.ShortSubTitle);
                        newArticle.SetValue("image", articleItem.ImageUrl);
                        newArticle.SetValue("imageAlt", articleItem.ImageAlt);
                        newArticle.SetValue("linkTitle", articleItem.LinkTitle);
                        newArticle.SetValue("articleUrl", articleItem.ArticleUrl);
                        newArticle.SetValue("fecha", Convert.ToDateTime(articleItem.PublicationDate));
                        newArticle.AssignTags("tags", articleItem.Taxonomies.ToArray<string>(), false, "default");
                        _contentService.SaveAndPublish(newArticle);
                    }
                }
    

    newArticle.AssignTags statement doesn't work in my example

    Any help please?

    Thanks

Please Sign in or register to post replies

Write your reply to:

Draft