Copied to clipboard

Flag this post as spam?

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


  • Brad 69 posts 97 karma points
    Dec 19, 2014 @ 20:27
    Brad
    0

    contentService.Save() not updating content

    I am using the content service to update some migrated articles.

    Dim articleUmb = contentService.GetChildren(umbDay.Id).Where(Function(x) x.GetValue("ektronID").ToString().Trim() = article("content_id").ToString().Trim()).FirstOrDefault()
    

    Is how I am getting the article, ektronID is a page in the old CMS.

    I am updating this way:

                articleUmb.CreateDate = CDate(article("date_created"))
                articleUmb.SetValue("snippet", "TEST")
                articleUmb.SetValue("metaDescription", md.GetItemByName("ARTICLE_PREVIEW").Value)
                articleUmb.SetValue("tags", GetTags(taxs))
    
                contentService.Save(articleUmb)
    

    There are no errors or anything. If I do SaveAndPublishWithStatus the result type is Success. But when I look at the content in the CMS none of the values have changed. In particular I am hard coding the property "snippet" to become "TEST" and that never updates.

  • Charles Afford 1163 posts 1709 karma points
    Dec 20, 2014 @ 21:22
    Charles Afford
    0

    Hi Brad,

    Are you able to debug?

    When you get to the contentService.Save method. Inspect the articleUmb object. In the properties are the correct values set?

    Have you checked the alias of the properties are correct?

    That looks good to me :)

  • Brad 69 posts 97 karma points
    Dec 22, 2014 @ 20:26
    Brad
    0

    I have checked and the values do update in the object upon save, but in the database they're not updated. The audit trail doesn't show any changes. I checked that the property aliases are correct.

    Edit: Please note this is just on a regular ASPX page I created in visual studio. Also the way I'm accessing ContentService is:

    Dim contentService As IContentService = ApplicationContext.Current.Services.ContentService

  • Charles Afford 1163 posts 1709 karma points
    Dec 25, 2014 @ 23:23
    Charles Afford
    0

    That all seems fine to me. If the object is updating then it must be doing what it is supposed to hmmm

  • Charles Afford 1163 posts 1709 karma points
    Dec 25, 2014 @ 23:25
    Charles Afford
    0

    Can you try with just one property snippet :). See if that works? I am assuming that one of the property is in the wrong format and everything is failing.

  • Tim 1193 posts 2675 karma points MVP 4x c-trib
    Jan 06, 2015 @ 16:36
    Tim
    0

    My money would be on the tags bit, especially if you're using the Umbraco tagging control.

Please Sign in or register to post replies

Write your reply to:

Draft