Question

I have created SharePoint custom list and added the post content type into the list. When I click 'view item' in list it redirects to post.aspx in post list(page not found).I need to redirect to use the existing dispform.aspx page within the list. Anyone suggest the better idea to resolve this issue?

Was it helpful?

Solution

You’d better not to use Post content type outside the Blog site. Create a custom content type and add columns you need into this content type.

In SharePoint lists/libraries, once the link of an item is clicked your get redirect to a page with the following url

http://<site> /_layouts/15/listform.aspx?PageType=4&ListID={ListID}&ID={ItemID}&ContentTypeID={ContentTypeID}

The PageType define whether it’s the display or editform for the item, 4 means display form.

The listform.aspx page reads the ContentTypeID, and then looks up the content type from the list and from the contenttype definitions finds the property DisplayFormUrl which is used for this content type.

You can use the following PowerShell to check the display page for the Post:

$web = get-spweb "http://<site>"
$list = $web.Lists["<list>"]
$ct = $list.ContentTypes["Post"]
$ct.DisplayFormUrl

By default, the DisplayFormUrl of the Post content type is “Lists/Posts/Post.aspx”. The full path should be “http://<site>/Lists/Posts/Post.aspx”. “Posts” is the list name and “Post.aspx” is the display page. If there is no “Posts” list in the site or there is no “Post.aspx” in this path, you will get “Page no found” error.

You can use the code to change DisplayFormUrl:

$ct.DisplayFormUrl = "Lists/<list>/<page>"
$ct.Update()

But per my test, it is difficult to display a post item on the page.

An easier way, create a custom content type instead of using Post content type.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top