Sunday, December 12, 2010

How-to Recreate a Corrupted Post.aspx page in SharePoint 2010

In the event that the Post.aspx page has become corrupted to where it is not showing any blogs, follow these instructions to easily recreate the page.

NOTE: You will need to have SharePoint Designer Enabled and Administrative Permissions to the site for this to work

1.       Using SharePoint Designer, Open the Blog Site by clicking Open Site
2.       From the Navigation quick menu, select All Files            
3.       In the results tab for All Files select Lists
4.       In the results tab for Lists, select Posts
5.       In the results tab for Posts, right-click Posts.aspx and select Delete
6.       In the Confirm Delete popup dialog, select Yes
7.       In the results tab for Posts, right-click AllPosts.aspx and select Copy
8.       Right-Click in the white-space in the results tab for Posts an and select Paste
9.       You should now have a file in the results tab for Posts named AllPosts_copy(1).aspx
10.   Right-Click on AllPosts_copy(1).aspx and select Rename and type Post.aspx
11.   Using Internet Explorer navigate to the site which was open in Step 1.
12.   From the blog site, select any Blog post to take you to the new Post.aspx page created in Step 10.
13.   From the Site Actions menu, select Edit Page
14.   On the Posts web part, select Edit Web Part from the web part drop-down menu.
15.   In the Web Part Properties menu on the right side of the screen, change Selected View to Summary View
16.   On the Message from webpage popup dialog, select OK
17.   In the Web Part Properties menu click Apply and then OK
18.   In the Main web part zone, select Add a Web Part
19.   From the Lists and Libraries categories library, select the list view Comments web part and select Add to add the web part to the Main zone
20.   Move the Comments list view web part below the Post list view web part.
21.   On the Comments web part, select Edit Web Part from the web part drop-down menu
22.   In the Web Part Properties menu on the right side of the screen, change Selected View to Summary View
23.   On the Message from webpage popup dialog, select OK
24.   In the Web Part Properties menu click Apply and then OK
25.   From the Edit Menu in the Ribbon, select Stop Editing from the Page Tab
26.   Using SharePoint Designer, Open the Blog Site by clicking Open Site, if the site is still open in SharePoint Designer make sure you refresh your content using the refresh button in the top left.
27.   From the Navigation quick menu, select All Files            
28.   In the results tab for All Files select Lists
29.   In the results tab for Lists, select Posts
30.   Right-Click on Post.aspx and select Edit File in Advanced Mode
31.   From the View tab in the menu ribbon, select Code, in Page Views
32.   At around line 49, there will be a <Query> tag under <XmlDefinition>. Replace everything from <Query> to </Query> with the following:
<Query>
   <OrderBy>
      <FieldRef Name="PublishedDate" Ascending="FALSE"/>
      <FieldRef Name="ID" Ascending="FALSE"/>
   </OrderBy>
   <Where>
      <Eq>
         <FieldRef Name="ID"/>
         <Value Type="">
            <GetVar Scope="Request" Name="ID"/>
         </Value>
      </Eq>
   </Where>
</Query>

33.   At around line 125, you will see the close tag for the Comments List View web part </WebPartPages:XsltListViewWebPart>. On the next line, paste in the following code. You will also need to change the highlighted GUID above with the GUID for the Comments list in your site. To determine the GUID for the Comments List, do the following:
1)      Using Internet Explorer navigate to the site which was open in Step 1.
2)      From the blog site, select any Blog post to take you to the new Post.aspx page created in Step 10.
3)      From the Site Actions menu, select View All Site Content
4)      Under the Lists category, select Comments
5)      From the List Tools menu in the ribbon, select List
6)      In the Settings category, select List Settings
7)      Copy the URL from the Internet Explorer browser and paste it into a Notepad
8)      Delete everything before List= (including List=)
9)      Delete %7B and %7D from the beginning and end
10)   Replace %2D with
11)   You should now have a properly formatted 32 character GUID (not including dashes) for the Comment List to replace the highlighted IDs
<WebPartPages:ListFormWebPart runat="server" __MarkupType="xmlmarkup" WebPart="true" __WebPartId="{C43398A5-8CDC-4080-871F-0E562F41EAC4}" >
<WebPart xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/WebPart/v2">
  <Title>New Comment</Title>
  <FrameType>None</FrameType>
  <Description />
  <IsIncluded>true</IsIncluded>
  <PartOrder>6</PartOrder>
  <FrameState>Normal</FrameState>
  <Height />
  <Width />
  <AllowRemove>true</AllowRemove>
  <AllowZoneChange>true</AllowZoneChange>
  <AllowMinimize>true</AllowMinimize>
  <AllowConnect>true</AllowConnect>
  <AllowEdit>true</AllowEdit>
  <AllowHide>true</AllowHide>
  <IsVisible>true</IsVisible>
  <DetailLink />
  <HelpLink />
  <HelpMode>Modeless</HelpMode>
  <Dir>Default</Dir>
  <PartImageSmall />
  <MissingAssembly>Cannot import this Web Part.</MissingAssembly>
  <PartImageLarge />
  <IsIncludedFilter />
  <ExportControlledProperties>true</ExportControlledProperties>
  <ConnectionID>00000000-0000-0000-0000-000000000000</ConnectionID>
  <ID>g_c43398a5_8cdc_4080_871f_0e562f41eac4</ID>
  <ListName xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">{5CC85BD4-19A5-438B-942C-ADECDF862EA3}</ListName>
  <ListId xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">5cc85bd4-19a5-438b-942c-adecdf862ea3</ListId>
  <PageType xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">PAGE_NEWFORM</PageType>
  <FormType xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">8</FormType>
  <ControlMode xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">New</ControlMode>
  <ViewFlag xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">1048576</ViewFlag>
  <ViewFlags xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">Default</ViewFlags>
  <ListTitle xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">Comments</ListTitle>
  <HideIfNoPermissions xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">true</HideIfNoPermissions>
  <ListItemId xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">0</ListItemId>
  <DisableInitialFocus xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">true</DisableInitialFocus>
  <TemplateName xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">BlogCommentsForm</TemplateName>
</WebPart>
</WebPartPages:ListFormWebPart>
34.   Click Save to apply the change.
35.   On the Site Definition Page Warning popup dialog select YES

5 comments:

  1. Hi,

    Thanks for the post. When I open SharePoint designer I cannot see "All Files" anywhere.

    Which version of SharePoint Designer do you use?

    Thanks
    MW

    ReplyDelete
    Replies
    1. ok I figured it out, I didn't have the correct permissions.

      This is brilliant, it worked really well. Thanks a lot.

      Delete
  2. Thank you for sharing this, we can discuss about this.

    Judithpof
    recover deleted files macbook

    ReplyDelete