Copied to clipboard

Flag this post as spam?

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


  • Ben Williams 5 posts 95 karma points
    Mar 13, 2018 @ 07:32
    Ben Williams
    0

    Update Blog Categories Programatically

    Hello, I finally figured out how to update the categories for a single blog entry by using this:

        [WebMethod]
        public string Update(int postId, string stuff)
        {
            var cs = ApplicationContext.Current.Services.ContentService;
            var post = cs.GetById(postId);
            post.SetValue("categories", stuff);
            var status = cs.SaveAndPublishWithStatus(post);
    
            return string.Format("updated post id {0}", post.Id);
        }
    

    How can I get a list of all Articulate blog entries (or even a filtered subset) and use a foreach loop to update the categories/tags by calling post.SetValue("categories", stuff)?

    Kind regards.

Please Sign in or register to post replies

Write your reply to:

Draft