Creating a blog post programatically RRS feed

  • Question

  • Hi

    Can anyone tell me if there is any way to create blog posts programatically ?

    I have a blog which users update different types of information daily.

    e.g each case has notes of activity each activity can be unique and be a seperate list.

    In order to view all activities a post should be submitted to the blog after submitting to the list.

    I dont have a great deal of knowledge with sharepoint 2007 and have inherited the current system which I am even wondering if it is the correct way to do it.

    Any help/hints/tips/ examples on how to solve this would be appreciated.

    Thanks in advance

    Friday, February 8, 2013 3:18 PM


  • Below might be helpful for you,


    And on your web part,implement the below code to push the post to the Blog's SubSite Post List,
    using (SPSite oSPsite = new SPSite("http://website url/"))

    using (SPWeb oSPWeb = oSPsite.OpenWeb())
                oSPWeb.AllowUnsafeUpdates = true;
                // Fetch the List
                SPList list = oSPWeb.Lists["Posts"];
                //Add a new item in the List
                SPListItem itemToAdd = list.Items.Add();
                itemToAdd["Title"] = "Test Title";
                itemToAdd["Description"] = "Test Description";
                // Get the Item ID
                listItemId = itemToAdd.ID;
                // Update the List item by ID
                SPListItem itemToUpdate = list.GetItemById(listItemId);
                itemToUpdate["Description"] = "Changed Description";
                // Delete List item
                SPListItem itemToDelete = list.GetItemById(listItemId);
                oSPWeb.AllowUnsafeUpdates = false;


    Let me know..!

    Monday, February 11, 2013 1:07 PM