More in this section

Forums / Developing with Sitefinity / Issue with Dynamic Blog Post Creation

Issue with Dynamic Blog Post Creation

2 posts, 0 answered
  1. derek
    derek avatar
    37 posts
    Registered:
    15 Jun 2007
    27 Feb 2009
    Link to this post
    I have a two part question:

    1) I've created a custom form for creating blog posts. Currently it creates the post, but the posts are not getting tagged with the proper BlogID.

    newContent.SetMetaData("BlogID", getBlogID(BlogName)); 

    where getBlogID is:

      protected Guid getBlogID(string blogName) 
            { 
                BlogManager blogManager = new BlogManager("Blogs"); 
     
                IList allBlogs = blogManager.GetBlogs(); 
     
                foreach (IBlog blog in allBlogs) 
                { 
                    //jondebugjondebug.Text = jondebug.Text + "|" + blog.Name; 
     
                    if (blog.Name.Trim() == blogName) 
                    { 
                        return blog.ID; 
                    } 
     
                } 
                return new Guid(); 
            } 


    I've been able to confirm that the method is returning a Guid with some debug statements, but the posts are going into sitefinity without going into a Blog.

    They show up in the recent content section of the dashboard, but that is only place I can find them.

    So my first question is why aren't these posts getting tagged properly.

    2) Since these posts don't show up in any of the blogs, what's the safest way to delete them? The only place I can see them is the "What's been up lately?" section of the dashboard but there is no delete feature from there.

  2. Ivan
    Ivan avatar
    478 posts
    Registered:
    16 Jun 2015
    02 Mar 2009
    Link to this post
    Hi derek,

    to assign the blog to a blog post, please use ParentID property of the IContent object (newContent in your case). As for the second question, you may search for all content items in blogs provider that have ParentId property == Guid.Empty.

    I hope you'll find this information helpful. Let us know if there is anything else we can do for you.

    All the best,
    Ivan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
2 posts, 0 answered