Copied to clipboard

Flag this post as spam?

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


  • Patrick 2 posts 21 karma points
    Apr 23, 2012 @ 22:56
    Patrick
    0

    Edit and publish existing Content node in Code with U5

    Hi,

     

    I'm looking for the right way for editing and publishing a content node from code. I can edit it, but how to publish?

    Here is the simple part that does saving...but not publishing.

    public bool EditContent(Content content, Dictionary<string, string> contentProperties)
    {
    Content activeContent = Hive.QueryContent().Single(x => x.Id == content.Id);

    foreach (var contentProperty in contentProperties)
    {
    if (activeContent.Attributes.Contains(contentProperty.Key))
    {
    activeContent.Attributes[contentProperty.Key].DynamicValue = contentProperty.Value;
    }
    }

    using (var writer = Hive.OpenWriter<IContentStore>())
    {
    writer.Repositories.AddOrUpdate(activeContent);
    writer.Complete();
    }

    return true;
    }

     

    Can anyone help me doing this "simple" action?

     

  • 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