SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

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>";


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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