miércoles, 20 de mayo de 2009

Repairing Supporting Files: “SharePoint alerts doesnt work” & “Invalid page URL”

We have the form customized and ready and working but suddenly… just when we are going to make use of the alert system of Sharepoint, it doesn't work, throwing the message "Unknown error" when trying to subscribe to an alert.
The option for New, Display or Edit list items makes the error: "Invalid page URL".

The bad functionality of these alerts is related with the messages "Invalid page URL" when creating a newListItem or the error "An unexpected error has occurred" when we do click in the edition of a listItem. They both produce when corrupting a Sharepoint List though the Supproting files remain unconfigured.
The problem happens when customizing an ASPX page like editform or newform, because we have deleted the ListFormWebPart which comes by default.

Correct customization procedure (Official):
If you want to customize the controls which appear in the NewForm.aspx and don't want to show the ListFormWebPart which appears by default, we can hide it instead of deleting it following these steps:

1. Start Sharepoint Designer 2007 and open the NewForm.aspx page from the list.
2. Right click on the ListFormWebPart and then click Web Part Properties.
3. Expand Layout, click on the checkbox "Hidden" and finally click "OK".

Procedure for repairing a screwed page or list:
The old procedure was… delete the list and create it again for personalize it later using the procedure, but there is another way.

1. Open the NewForm.aspx, EditForm.aspx and DispForm.aspx in the Sharepoint Designer.

2. Search the following tag: <WebPartPages:WebPartZone runat="server" FrameType="None" ID="Main" Title="loc:Main"><ZoneTemplate> in the screwed page.

3. Paste between the tags <ZoneTemplate> Paste here <ZoneTemplate> this code:

<WebPartPages:ListFormWebPart runat="server" __MarkupType="xmlmarkup" WebPart="true" __WebPartId="{MY NEW GENERATED GUID}" >
<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>LIST NAME</Title><FrameType>None</FrameType><Description /> <IsIncluded>true</IsIncluded><PartOrder>1</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>false</IsVisible> <DetailLink /> <HelpLink /><HelpMode>Modeless</HelpMode><Dir>Default</Dir> <PartImageSmall /> <MissingAssembly>Cannot import this Web Part.</MissingAssembly><PartImageLarge /> <IsIncludedFilter /><ExportControlledProperties>true</ExportControlledProperties>
<ListName xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">{MY SHAREPOINT’S GUID FROM THE LIST}</ListName>
<ListItemId xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">0</ListItemId>
<ControlMode xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">Edit</ControlMode> <TemplateName xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">ListForm</TemplateName>
<FormType xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">6</FormType><ViewFlag xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">1048576</ViewFlag>

4. In the line of <ControlMode if the page is:
EditForm we have to put Edit
NewForm we have to put New
DispForm we have to put Display

5. In the line of <FormType if the page is :
EditForm we have to put 6
NewForm we have to put 8
DispForm we have to put 4

6. In the line <ListName we have to put the GUID of the Sharepoint's List that we are repairing. Also change <Title putting the name of the list.
(It can be obtained in the Sharepoint Site by customizing the list or in "Site Settings > Site Libraries and Lists" and looking in the link of customize of the list appears the GUID, right clicking and copying the direct access)

The line would stay like this:
<ListName xmlns="htp://schemas.microsoft.com/WebPart/v2/ListForm">{046F5668-1891-4781-9B44-90AC0C0B600A}</ListName>

7. Generate a new GUID with guidgen.exe or using the page: http://www.somacon.com/p113.php

8. In the line <ID put the new GUID replacing the dashes by low dashes leaving a "g_" in the beginning. Example: If the GUID is 870850be-fd2c-44d6-818e-ab2914fb2d71 it should stay like this g_870850be_fd2c_44d6_818e_ab2914fb2d71

9. Save (I don't recommend to save before), it is possible that you must close and open again the page to see the result of the reparation.

10. Repeat this same operation for the pages NewForm.aspx, EditForm.aspx, DispForm.aspx and all of the attachments of Supporting Files will stay repaired. By this point we would have repaired the list, the alerts, the RSS and the actions of New, Edit and Display so:

Everything will work properly

Look before and after.


10 comentarios:

  1. This information was exactly what I was looking for. You saved my life (or at least my list :-) Thanks

  2. Hi I followed your steps but I am getting "Error rendering web part" on repaired web parts.
    can you help me why this is comming.
    my mail id is rak.ran@hotmail.com

  3. Thanks a lot!
    I works but i have a few thing to add:
    Set IsVisible true or you will see nothing
    Each of NewForm.aspx, EditForm.aspx, DispForm.aspx must have different generated guid

  4. Thank you - I don't know what got screwed up. The supporting files all still were set correctly. Generating a new GUI for the webpart solved the problem.

  5. Thank you Roberto! Saved my list, much appreciated!

  6. Thank you, Roberto! I have tried fixing this major problem with a couple of similar posts, but only your clear, step-by-step instrcutions got me through to the solution. Thanks Again!

    John Waller
    Mystic, CT USA

  7. YOU ARE MY HERO!!! For a couple of days I was afraid I screwed up the whole list and needed to start from scratch.

    A million thanks!

    Quincy Thomas

  8. Thanks for the help....you are a great!!