Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have blog for our management team. Assistants will be posting instead of the managers. I have created a column called "Author" which is "people/group" lookup field for the assistants to add a person (manager) as author. Now, instead of displaying Created by column, I want to display "Author" column in blog post web part as Author: Manager Name.

But I am not able to change the web part view. Is there way to add this to a blog post? Or to add it inside a blog post body as Author: Manager Name. ?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

I went a little different direction to fix this problem before. I created a special webpart which allowed you to configure it to create a blog post as another user. Here is the meat of the code to accomplish that:

//UserId = string of full login name of manager/person you want the blog to be created by
//listView = SPView of the blog
using (SPWeb listWeb = listView.ParentList.ParentWeb)
{
    SPUserToken token = listWeb.AllUsers[UserId].UserToken;
    using (SPSite site = new SPSite(listWeb.Url, token))
    {
        using (SPWeb web = site.OpenWeb(listWeb.ServerRelativeUrl))
        {
            SPList list = web.Lists[listView.ParentList.ID];
            SPListItem item = list.Items.Add();
            item.Update();
            string formUrl = web.Url + "/" + list.Forms[PAGETYPE.PAGE_EDITFORM].Url
            formUrl = formUrl.Replace(" ", "%20");
            SPUtility.Redirect(formUrl + "?ID=" + item["ID"], SPRedirectFlags.Default, Context);
        }
    }
}
share|improve this answer

You need to modify the aspx page with the webpart. Assume its default blog site and page is default.aspx.

  1. Open this page in Sharepoint Designer
  2. Select element with createdby info in "Design view"
  3. Select "Design" tab in List View Tools, then "Customize XSLT", then "Customize Item"
  4. Edit XSL as you wish, Save Page and voilа enter image description here
share|improve this answer

Your Answer

 
discard

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.