I am trying to brand a blog post according to our standards, and to do that I have simply created a custom visual web part to take the place of the SharePoint default. What I am wondering is how am I going to extract the body and title of the individual blog posts within this custom one? I can get the list of Posts no problem, but what I need is the actual content.

I am hoping to be able to simply hide the original posts web part and extract the data from it, showing it in the custom one, so that when the blogger creates a new post, it will always show up in this custom web part, too.

1 Answer 1


The body and title are accessible through the SPListItem object associated with each post in the list.

I didn't test this, but assuming your list is in the object oList and the body field is "body", the following code should output the Title and Body for all of the posts.

foreach (SPListItem oListItem in oList.Items)
    Label1.Text += SPEncode.HtmlEncode(oListItem["Title"]) + " 
       -- " + 
       SPEncode.HtmlEncode(oListItem["Body"]) + "<BR>";


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.